Forums

ASP

This topic is locked

ASP Newbe / forums

Posted 06 Feb 2006 01:10:10
1
has voted
06 Feb 2006 01:10:10 Jack Black posted:
Hi Guys,

I have been playing around with dreamweavers form's feature and now need some code/programming help. What I have is a question that allows the user to select from 4 different answers that have radio buttons next to the answers. Now A is the correct answer, and if they click on the option A radio button and then hit submit, or continue I want a page redirect to happen. Where as if they click on any of the other radio button and hit submit I want them redirected to a different page...

Can anyone give me some help?

Replies

Replied 06 Feb 2006 22:06:09
06 Feb 2006 22:06:09 Russell Biscardine replied:
OK, not sure if this is what you want, but here goes...

<pre id=code><font face=courier size=2 id=code>

Dim Question, Answer
Question = "What is the capital of France?"
Answer = "2"

If Request.Form &lt;&gt; "" Then

If Request.Form("Questions" = Answer Then
Response.Redirect("Correct.asp"
Else
Response.Redirect("Incorrect.asp"
End If

End If
</font id=code></pre id=code>

Here is the HTML part

<pre id=code><font face=courier size=2 id=code>
&lt;form action="" method="post" name="QNA"&gt;
&lt;P&gt;&lt;%=Question%&gt;&lt;/P&gt;
&lt;p&gt;
&lt;label&gt;
&lt;input type="radio" name="Questions" value="1"&gt;
London&lt;/label&gt;
&lt;br&gt;
&lt;label&gt;
&lt;input type="radio" name="Questions" value="2"&gt;
Paris&lt;/label&gt;
&lt;br&gt;
&lt;label&gt;
&lt;input type="radio" name="Questions" value="3"&gt;
Hamburg&lt;/label&gt;
&lt;br&gt;
&lt;label&gt;
&lt;input type="radio" name="Questions" value="4"&gt;
Barcelona&lt;/label&gt;
&lt;br&gt;
&lt;/p&gt;
&lt;input name="Check" type="submit" value="Check"&gt;
&lt;/form&gt;
</font id=code></pre id=code>

<a href="www.code-z.co.uk" title="Code-Z :: Digital Media &amp; Content Creation"><img src="www.code-z.co.uk/media/AffiliateLogo.jpg" border="0"></a>

Reply to this topic