Online <%
Curq = Request.Form ("Curq")
ANSW = Request.Form ("ANSW")
Correct=request.form ("correct")
Wrong=request.form ("wrong")
' Poor man ' s IsNull Code goes here
If poormansisnull (CURQ) Then
CURQ = 1
correct = 0
Wrong = 0
End If
If poormansisnull (ANSW) Then
CURQ = Curq + 1
If Curq > (Your Maximum number of questions) Then
%>
<p>congratulations. You are have completed this test. You missed <%=wrong%>
Questions
But got <%=correct%> questions right. That's equivilent to a
<%= (correct/(MAX#OFQS)%>%.
Thank for doing the test.
<% End If%>
<% Set conntemp = Server.CreateObject ("Adodb.connection")
Set MyDSN = ' (your DSN info goes here)
Conntemp. Open MyDSN
Set MySQL = "SELECT * from QUESTIONS WHERE questionid=" & Curq
Set rstemp= conntemp. Execute (MySQL)
%>
<form method=post action= "myasp.asp" >
<input Type=hidden Name=curq value=<%=curq%>>
Your question is <%=rstemp ("question")%><br>
Answer:
<select name= "ANSW" >
<option value=1><%=rstemp ("Answera") </option>
<option value=2><%=rstemp ("Answerb") </option>
<option value=3><%=rstemp ("Answerc") </option>
<option value=4><%=rstemp ("Answerd") </option>
</select>
<input type=hidden value= "<%=correct%>" ><input type=hidden value= "<%=wrong%>" >
<input Type=reset value= "clear the Form" ><input type=submit value= "ok!" >
</form>
<% Else%>
<% Set conntemp = Server.CreateObject ("Adodb.connection")
Set MyDSN = ' (your DSN info goes here)
Conntemp. Open MyDSN
Set MySQL = "SELECT * from QUESTIONS WHERE questionid=" & Curq
Set rstemp= conntemp. Execute (MySQL)
If ANSW = rstemp ("Correctans") Then
%>
<p>congratulations. You are got it right. Whee</p>
<% correct = correct + 1%>
<% Else%>
<p>i ' m sorry, you missed the question. Can review by
Reading: </p>
<p><%=rstemp ("reference") </p>
<% wrong = wrong + 1%>
<% End If%>
<form method=post action= "myasp.asp" >
<input type= "hidden" Name=curq value= "<%=curQ%>" >
<input type= "hidden" name=correct value= "<%=correct%>" >
<input type= "hidden" Name=wrong value= "<%=wrong%>" >
<input type= "Submit" value= "Next question"%>
</form>
<% End If%>