[thelist] ASP: variable in a comparison

aardvark roselli at earthlink.net
Thu Sep 7 23:25:14 CDT 2000


> From: McCreath_David [McCreath_David at xmail.asd.k12.ak.us]
>
> Ooooh...I hope somebody's awake...

certainly not me... east coast time, baby...

>   if Request.Form("navigation")="'call variable
> here'" then
>   Response.Redirect("step'call variable here'.asp")
>
> I tried this:
>
>   if Request.Form("navigation")="& VariableName &" then
>
> and that's not working. (I have the
> Response.Redirect hardcoded right now.)

erm, i'm quite tired, but lemme see...

let's call your variable in advance, just to make it easy...
by giving a request object a name, it'll make it a bit
easier...

<%
strFormNum = Request.Form("navigation")
strStepNum = [Request...cookie/session/form/etc. or whatever
since i don't know how you have gotten this variable, or if
it's hard-coded or what]

IF strFormNum = strStepNum THEN
	response.redirect "step" & strStepNum &".asp"
ELSE
	'do something here, like show an error
END IF
%>

without an 'else' statement, anything that is not equal will
just sit there... i haven't tried dynamically building a
redirect before (dunno why)... also, make sure you haven't
written any headers yet or the redirect won't work... for
more robust comparisons (right now you're doing a
text/string comparison), you may need to convert the
variable to a number (cint()) in your 'IF' in order to play
with it...

are you getting any errors?  what version ASP?

> Longish explanation:

i'm snipping this cuz i don't wanna confuse me (and i is)...





More information about the thelist mailing list