Right this may seem like an identical thread but this time i've managed to get my question in too o:|
Right i am making a multiple choice quiz, i have a recordset called questions throught which i select the question number, the querstion itslef and the 4 answers.
I display the answers in a form so the user can check a box click submit and then move to the next question. heres wheer i'm havibn trouble.
When i clcik sumbit instead of doin the movenext (is this in the right place??) which i have higlighted. it simply opens another recordset.
my code is below, i can send the dbase asell if ur that interested.
Cheers.
<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE>CP2023 - Computer Networks</TITLE>
<SCRIPT ID=serverEventHandlersVBS LANGUAGE=vbscript RUNAT=Server>
</SCRIPT>
</HEAD>
<BODY>
<%
dim Conn, Questions, Conn2, Answers
dim MyArray(20)
dim varBook
Set Conn = Server.CreateObject("ADODB.Connection"
Set Questions = Server.CreateObject("ADODB.Recordset"
Set Answers = Server.CreateObject("ADODB.Recordset"
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Conn.Open "Provider =Microsoft.Jet.OLEDB.4.0;" &_
"Data Source = C:\Inetpub\ &_
"Persist Security Info=False" ' CONNECTION TO DATABASE
strSQL = "SELECT * FROM questions" 'QUESRY THE TABLE QUESTION FOR ALL RECORDS
Questions.Open strSQL, Conn, adOpenDynamic 'OPEN RECORDSET
strSQL = "SELECT * FROM student" 'QUESRY THE TABLE ANSWERS FOR ALL RECORDS
Answers.Open strSQL, Conn, adOpenDynamic 'OPEN RECORDSET
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Curnq = questions("Question Number"
MyArray(Curnq)= Request.Form("Answer"
Response.Write Myarray(Curnq)
%>
<H2>You are currently on question number <%Response.Write Questions("Question Number"
%><BR><BR><BR>
<%Response.Write Questions("Question"
%><BR>
<form action="test.asp" method="post" name=Form>
<p><input TYPE="radio" NAME="Answer" VALUE="A"><%Response.Write Questions("Answer A"
%></p>
<p><input TYPE="radio" NAME="Answer" VALUE="B"><%Response.Write Questions("Answer B"
%></p>
<p><input TYPE="radio" NAME="Answer" VALUE="C"><%Response.Write Questions("Answer C"
%></p>
<p><input TYPE="radio" NAME="Answer" VALUE="D"><%Response.Write Questions("Answer D"
%></p>
<input type="submit" Value ="Forwards><%Questions.MoveNext%></form></H2>
</BODY>
</HTML>
Right i am making a multiple choice quiz, i have a recordset called questions throught which i select the question number, the querstion itslef and the 4 answers.
I display the answers in a form so the user can check a box click submit and then move to the next question. heres wheer i'm havibn trouble.
When i clcik sumbit instead of doin the movenext (is this in the right place??) which i have higlighted. it simply opens another recordset.
my code is below, i can send the dbase asell if ur that interested.
Cheers.
<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE>CP2023 - Computer Networks</TITLE>
<SCRIPT ID=serverEventHandlersVBS LANGUAGE=vbscript RUNAT=Server>
</SCRIPT>
</HEAD>
<BODY>
<%
dim Conn, Questions, Conn2, Answers
dim MyArray(20)
dim varBook
Set Conn = Server.CreateObject("ADODB.Connection"
Set Questions = Server.CreateObject("ADODB.Recordset"
Set Answers = Server.CreateObject("ADODB.Recordset"
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Conn.Open "Provider =Microsoft.Jet.OLEDB.4.0;" &_
"Data Source = C:\Inetpub\ &_
"Persist Security Info=False" ' CONNECTION TO DATABASE
strSQL = "SELECT * FROM questions" 'QUESRY THE TABLE QUESTION FOR ALL RECORDS
Questions.Open strSQL, Conn, adOpenDynamic 'OPEN RECORDSET
strSQL = "SELECT * FROM student" 'QUESRY THE TABLE ANSWERS FOR ALL RECORDS
Answers.Open strSQL, Conn, adOpenDynamic 'OPEN RECORDSET
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Curnq = questions("Question Number"
MyArray(Curnq)= Request.Form("Answer"
Response.Write Myarray(Curnq)
%>
<H2>You are currently on question number <%Response.Write Questions("Question Number"
<%Response.Write Questions("Question"
<form action="test.asp" method="post" name=Form>
<p><input TYPE="radio" NAME="Answer" VALUE="A"><%Response.Write Questions("Answer A"
<p><input TYPE="radio" NAME="Answer" VALUE="B"><%Response.Write Questions("Answer B"
<p><input TYPE="radio" NAME="Answer" VALUE="C"><%Response.Write Questions("Answer C"
<p><input TYPE="radio" NAME="Answer" VALUE="D"><%Response.Write Questions("Answer D"
<input type="submit" Value ="Forwards><%Questions.MoveNext%></form></H2>
</BODY>
</HTML>