I am creating a little online quiz (5 questions - true and false). Basically, what I try to do is: if the answer is wrong then display a message 揟ry again? if the answer is right then display 揧ou抮e correct? and then go to the next question. We also would like to store all the answers (right and wrong) into the database. After answering all these questions then ask user go to the next page. How do we do it? Please give me some ideas or suggestions to do it. Thanks a lot in advance.
I found the link: http://www.cerritos.edu/sr/Online_Orientation/STEP8_Conclusion-Quiz/quiz_final05.asp this is something that we want to do for our volunteer online quiz. How did they do it?
Below is just html code....
Code:
<%@ Language=VBScript %>
<%Response.Buffer=true%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>quiz</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body>
<form id="Form1" action="nextpage.asp" method="post" runat="server">
<table border="0" cellpadding="7" cellspacing="0" ID="Table3">
<tr><td>Question 1</td></tr>
<tr>
<td>
<input type="radio" value="true" name="true">True
<input type="radio" value="false" name="false" ID="Radio1">False
</td>
</tr>
<tr><td>Question 2</td></tr>
<tr>
<td>
<input type="radio" value="true2" name="true2" ID="Radio2">True
<input type="radio" value="false2" name="false2" ID="Radio3">False
</td>
</tr>
<tr><td>Question 3</td></tr>
<tr>
<td>
<input type="radio" value="true3" name="true3" ID="Radio4">True
<input type="radio" value="false3" name="false3" ID="Radio5">False
</td>
</tr>
<tr><td>Question 4</td></tr>
<tr>
<td>
<input type="radio" value="true4" name="true4" ID="Radio6">True
<input type="radio" value="false4" name="false4" ID="Radio7">False
</td>
</tr>
<tr><td>Question 5</td></tr>
<tr>
<td>
<input type="radio" value="true5" name="true5" ID="Radio8">True
<input type="radio" value="false5" name="false5" ID="Radio9">False
</td>
</tr>
</table>
<input type="submit" name="NEXT" value="Next" ID="Submit1">
</form>
</body>
</html>
Most likely you'll write a page with the first question and post that answer back to an asp page on the server that tests the answer, and generates either a browser page with the next question or a browser page with an error message.
There are good tutorials on asp and databases at www.w3schools.com
Was this answer helpful ?
Yes No
Was this answer helpful ?
Yes No
Hey why blank!!????
what doug G said is correct. u can prepare your pages like that.
We cant write the whole code for u. u jst try some code and if u find any problem in it then post it back
Was this answer helpful ?
Yes No
Thanks Doug G for giving me a hint how to do it.
I truly need your all help. I cannot think of any way how to do this:
I have 3 different pages:
1. user info (index.asp)
2. questions (Q1.asp)
3.more questions (Q2.asp) ---> submit go to thank you page.
---
1. Carry user information from index.asp page to Q1.asp, I used hidden fields. It seems work fine.
2. What we try to do is we would like to save all answer(s) (right and wrong) into the DB. After question # 3 is answered (Q1.asp) then go to Q2.asp
3. How can we carry answers from Q1.asp to Q2.asp ( or how to save it into the DB from this point before go to Q2)?
I am really appreciated for your time and help.
below are the code:
index.asp
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>application</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body MS_POSITIONING="GridLayout">
<p><i>Fields marked with an asterisks (<font color="#FF0000">*</font>) are required.</i></p>
<Form method="POST" name="VolForm" action="Q1.asp" onsubmit="return FormValidator(this)" ID="Form1">
<table border="0" ID="Table1">
<tr>
<td valign="top">Name:<font color="red">*</font></td>
<td valign="top">
<input type="text" name="First_Name" size="20" ID="Text3"><br>
(first or given name)
</td>
<td valign="top">
<input type="text" name="MI" size="5" ID="Text4"><br>
(mi)
</td>
<td valign="top">
<input type="text" name="Last_Name" size="25" ID="Text2"><br>
(last or family name)
</td>
</tr>
<tr>
<td valign="top" nowrap>Telephone Number:<font color="red">*</font></td>
<td valign="bottom" colspan="3">
<input type="text" onkeyup="jm_phonemask(this)" name="Phone" size="12" ID="Text5">
</td>
</tr>
<tr>
<td valign="top">Email Address<br>(optional)</td>
<td colspan="3">
<input type="text" name="Email" size="55" ID="Text6"><br>
</td>
</tr>
<tr>
<td valign="top" colspan="4" align="center">
<input type="submit" name="Submit" value="Next" ID="Submit1">
</td>
</tr>
</table>
</form>
</body>
</html>
Q1.asp
Code:
<%@ Language=VBScript %>
<%Response.Buffer=true%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>application </title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body>
<%
dim Q1, Q2, Q3
Q1=Request.Form("Q1")
Q2=Request.Form("Q2")
Q3=Request.Form("Q3")
%>
<form action="Q1.asp" method="post" ID="Form2">
<input type="hidden" name="Last_Name" value="<%=Request.Form("Last_Name")%>" ID="Hidden1">
<input type="hidden" name="First_Name" value="<%=Request.Form("First_Name")%>" ID="Hidden2">
<input type="hidden" name="MI" value="<%=Request.Form("MI")%>" ID="Hidden3">
<input type="hidden" name="Phone" value="<%=Request.Form("Phone")%>" ID="Hidden4">
<input type="hidden" name="Email" value="<%=Request.Form("Email")%>" ID="Hidden5">
<!--<input type="hidden" name="Q1" value="<%=Request.Form("A")%>">
<input type="hidden" name="Q1" value="<%=Request.Form("B")%>" ID="Hidden6">
<input type="hidden" name="Q1" value="<%=Request.Form("C")%>" ID="Hidden7">
<input type="hidden" name="Q2" value="<%=Request.Form("A")%>" ID="Hidden8">
<input type="hidden" name="Q2" value="<%=Request.Form("B")%>" ID="Hidden9">
<input type="hidden" name="Q3" value="<%=Request.Form("A")%>" ID="Hidden10">
<input type="hidden" name="Q3" value="<%=Request.Form("B")%>" ID="Hidden11">
<input type="hidden" name="Q3" value="<%=Request.Form("C")%>" ID="Hidden12">
--->
<p>Question1</p>
<input type="radio" name="Q1" <%if Q1="A" then Response.Write("checked")%> value="A" ID="Radio10">Yes</input>
<br>
<input type="radio" name="Q1" <%if Q1="B" then Response.Write("checked")%> value="B" ID="Radio11">No</input>
<br>
<input type="radio" name="Q1" <%if Q1="C" then Response.Write("checked")%> value="C" ID="Radio12">Not sure</input>
<br><br>
<%
if Q1 = "A" then
Response.Write("<p>Yes, you are correct</p>")
' Response.Write("<input type=""submit"" value=""Submit"" ID=""Submit2"" NAME=""Question2""/>")
elseif Q1="B" or Q1="C" then
Response.Write("<p>INCORRECT:</p>")
end if
%>
<%if Q1 = "A" then%>
<p>Question 2</p>
<input type="radio" name="Q2" <%if Q2="A" then Response.Write("checked")%> value="A" ID="Radio1">
True</input>
<br />
<input type="radio" name="Q2" <%if Q2="B" then Response.Write("checked")%> value="B" ID="Radio2">
False<br>
<%if Q2="A" then
response.Write("<p>Yes, you are correct</p>")
elseif Q2="B" then
response.Write("<p>Try again</p>")
end if
%>
<%end if%>
<%if Q1 = "A" and Q2="A" then%>
<p>Question 3</p>
<input type="radio" name="Q3" <%if Q3="A" then Response.Write("checked")%> value="A" ID="Radio3">
True</input>
<br />
<input type="radio" name="Q3" <%if Q3="B" then Response.Write("checked")%> value="B" ID="Radio4">
False<br>
<input type="radio" name="Q3" <%if Q3="C" then Response.Write("checked")%> value="C" ID="Radio5">
Not sure<br>
<%if Q3="B" then
response.Write("<p>Yes, you are correct</p>")
elseif Q3="A" or Q3="C" then
response.Write("<p>Try again</p>")
end if
%>
<%end if%>
<input type="submit" value="Next" name="Next">
</form>
</body>
</html>
Q2.asp
Code:
<%@ Language=VBScript %>
<%Response.Buffer=true%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>application </title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body>
<form action="thanks.asp" method="post" ID="Form2">
<p>Are you currently a volunteer?</p>
<input type="radio" name="VolunteerYN" value="yes" ID="Radio10">Yes</input>
<br />
<input type="radio" name="VolunteerYN" value="no">No</input>
<br>
<p>If Yes, what organization?
<input name="Belong" size="25" ID="Text1"></p>
<input type="submit" value="Submit" name="Submit" ID="Submit1">
</form>
</body>
</html>
Was this answer helpful ?
Yes No