|
| |
|
|
shmcadoo
Posts: 33 Joined: 11/21/2003 Status: offline
|
A little help with an If - Then statement - 5/14/2004 12:43:41
I am passing parameters through a hyperlink from a results page to a page that I want to compare the parameters and then redirect. These parameters include two numbers. I am trying to do this. IF 1stvalue => 2ndvalue THEN response.write ("session is full") Else show form. I am not able to put it all together to complete this task. Thanks for your help.
|
|
|
|
BeTheBall
Posts: 6381 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: A little help with an If - Then statement - 5/14/2004 12:58:46
First, are you sure the parameters are making it through? If so, you should see them in the URL. Assuming they are, then something like this: In the body just before the form, paste this: <% If Value1 >= Value2 Then Response.write "Session is full." Else %> Then after your form, enter: <%End If%> That should work.
< Message edited by betheball -- 5/14/2004 10:59:16 >
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
shmcadoo
Posts: 33 Joined: 11/21/2003 Status: offline
|
RE: A little help with an If - Then statement - 5/14/2004 13:43:22
Unfortunately I don't think like either of you yet! I pasted this before any code: <% IF CntOfAttendees=> Seats THEN response.write ("session is full") ELSE%> and this after all code: <%END IF%> No matter what the values are the page displays "Session is Full" and never displays the form. The values are passing into the URL for this page. Is there a format for the values that I need to use?
|
|
|
|
BeTheBall
Posts: 6381 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: A little help with an If - Then statement - 5/14/2004 13:51:21
Try this in place of the first snippet above. <% Dim CntofAttendees, Seats CntofAttendees=CInt(Request.QueryString("CntofAttendees")) Seats=CInt(Request.QueryString("Seats")) IF CntOfAttendees=> Seats THEN response.write ("session is full") ELSE%> Also, I am not positive you can put the snippet at the very beginning of the page. I would suggest you put it just before the <form> tag.
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
shmcadoo
Posts: 33 Joined: 11/21/2003 Status: offline
|
RE: A little help with an If - Then statement - 5/14/2004 13:51:50
The CntOfAttendees value comes from a COUNT in db and the seats value is from a table and is a number.
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: A little help with an If - Then statement - 5/14/2004 14:25:02
Generally speaking, if you're going to use VBScript variables outside the current code block (the <% and %>), then you should DIM them. If not (and IIRC) the variables only apply to the local block. It's also good practice to define all variables. I have had circumstances where I've used the same variable name twice. By DIMming them, VBScript will tell me that I've already defined it and hence avoid the problem.
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|