HTML/ASP Form Trouble


I have a form on an asp page (Showcaptive.asp), that creates two random numbers for a poor man's 'Captiva' validation, but when I get to the Captiva.asp page I can show both numbers but the if statement still say they're different.  

[showcaptiva.asp] (just the form)

<form action="Captiva.asp" method="get" class="style1">
      <p class="style2">Your Name<br>
<input name="EmailFrom" type="text" size="70">
<p class="style2">Your Email Address<br>
<input name="EmailTo" type="text" size="70">
<p class="style2">Subject<br>
<input name="Subject" type="text" size="70">
<p class="style2">Message<br>
<textarea name="Message" cols="70"></textarea>
dim RNDNumber1
dim RNDNumber2
RNDNumber1 = round(rnd*10)
RNDNumber2 = round(rnd*10)
'response.write("<BR>" & RNDNumber1 & "<BR>" & RNDNumber2 & "<BR>")
session("Result") = RNDNumber1+RNDNumber2


<p class="style2">In an effort to limit spam, please calculate the result of the two numbers below:<br>
<%=RNDNumber1 & " + " & RNDNumber2 & " = "%><input name="Captiva" type="text" size="20">

<p><input type="submit" name="submit" value="Submit">


In the asp page below I show no1 and no2 and they are identical, but the if statement never comes past the "Sorry that was not the correct result...


no1 = request("Captiva")
no2 = session("Result")

response.write("-->" & no1 & "<--" & "<br>" & "-->" & no2 & "<--<BR>")
      if no1 <> no2 then
            response.write("Sorry that was not the correct result, please go back and try again!")      
' do what I'm supposed to do...
Who is Participating?
nap0leonConnect With a Mentor Commented:
When the page posts, everything is turned into "strings".
Since the "Result" was calculated using numbers, it is still a "number".
Wrap a "cint" around the answer to make sure things are numbers.
no1 = cInt(request("Captiva"))
no2 = session("Result")

Open in new window

or, here:
if cInt(no1) <> no2 then

Open in new window

prositAuthor Commented:
Knew it was simple :)

All Courses

From novice to tech pro — start learning today.