<%@LANGUAGE="VBSCRIPT"%> <!--#include file="include/test_connect.asp" --> <% Query = "select * FROM questions WHERE test_name = '" + Request.QueryString("test") + "'" Set RS = Server.CreateObject("ADODB.Recordset") RS.Open Query, test_connector, 3, 3 questions_total=0 While (Not RS.EOF) questions_total = questions_total + 1 RS.MoveNext Wend ' reset the cursor to the beginning If (RS.CursorType > 0) Then RS.MoveFirst Else RS.Requery End If %> <html> <head> <title>Questions</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="aliceblue"> <table width="100%"> <tr> <td height="520" valign="top"><!--#include file="test_menu.asp" --><br> </br></td> <td width="100%" valign="top"><table width="100%"> <tr> <td width="100%" height="520" valign="top"> <div align="center"><br> <table width="80%"> <form name="form1" method="post" action="<%= "test_grade.asp?test=" & Request.QueryString("test") & "&questions=" & Request.QueryString("questions")%>"> <% While (NOT RS.EOF) qnum = qnum + 1 answer_num = 0 if RS.Fields.Item("a1").Value = true then answer_num = answer_num + 1 end if if RS.Fields.Item("a2").Value = true then answer_num = answer_num + 1 end if if RS.Fields.Item("a3").Value = true then answer_num = answer_num + 1 end if if RS.Fields.Item("a4").Value = true then answer_num = answer_num + 1 end if if RS.Fields.Item("a5").Value = true then answer_num = answer_num + 1 end if %> <% If answer_num < 2 then %> <tr> <td> <%=( qnum & ") " & RS.Fields.Item("question").Value)%></td> </tr> <% if not (RS.Fields.Item("answer1").Value = "n/a") then %> <tr> <td>A) <input type="radio" name="<%= "question" & (RS.Fields.Item("id").Value) %>" value="<%= "question" & (RS.Fields.Item("id").Value) & "a" %>"> <%=(RS.Fields.Item("answer1").Value)%> <% 'if (RS.Fields.Item("a1").Value) then Response.Write(" (correct)")%> </td> </tr> <% end if %> <% if not (RS.Fields.Item("answer2").Value = "n/a") then %> <tr> <td>B) <input type="radio" name="<%= "question" & (RS.Fields.Item("id").Value) %>" value="<%= "question" & (RS.Fields.Item("id").Value) & "b" %>"> <%=(RS.Fields.Item("answer2").Value)%> <% 'if (RS.Fields.Item("a2").Value) then Response.Write(" (correct)")%> </td> </tr> <% end if %> <% if not (RS.Fields.Item("answer3").Value = "n/a") then %> <tr> <td>C) <input type="radio" name="<%= "question" & (RS.Fields.Item("id").Value) %>" value="<%= "question" & (RS.Fields.Item("id").Value) & "c" %>"> <%=(RS.Fields.Item("answer3").Value)%> <%'if (RS.Fields.Item("a3").Value) then Response.Write(" (correct)")%> </td> </tr> <% end if %> <% if not (RS.Fields.Item("answer4").Value = "n/a") then %> <tr> <td>D) <input type="radio" name="<%= "question" & (RS.Fields.Item("id").Value) %>" value="<%= "question" & (RS.Fields.Item("id").Value) & "d" %>"> <%=(RS.Fields.Item("answer4").Value)%> <% 'if (RS.Fields.Item("a4").Value) then Response.Write(" (correct)")%> </td> </tr> <% end if %> <% if not (RS.Fields.Item("answer5").Value = "n/a") then %> <tr> <td> <p> E) <input type="radio" name="<%= "question" & (RS.Fields.Item("id").Value) %>" value="<%= "question" & (RS.Fields.Item("id").Value) & "e" %>"> <%=(RS.Fields.Item("answer5").Value)%> <% 'if (RS.Fields.Item("a5").Value) then Response.Write(" (correct)")%> </p></td> </tr> <% end if %> <tr> <td> <p> </p></td> </tr> <% else %> <tr> <td> <%=( qnum & ") " & RS.Fields.Item("question").Value)%></td> </tr> <% if not (RS.Fields.Item("answer1").Value = "n/a") then %> <tr> <td>A) <input type="checkbox" name="<%= "question" & (RS.Fields.Item("id").Value) & "a" %>" value="True"> <%=(RS.Fields.Item("answer1").Value)%> <% 'if (RS.Fields.Item("a1").Value) then Response.Write(" (correct)")%> </td> </tr> <% end if %> <% if not (RS.Fields.Item("answer2").Value = "n/a") then %> <tr> <td>B) <input type="checkbox" name="<%= "question" & (RS.Fields.Item("id").Value) & "b" %>" value="True"> <%=(RS.Fields.Item("answer2").Value)%> <% 'if (RS.Fields.Item("a2").Value) then Response.Write(" (correct)")%> </td> </tr> <% end if %> <% if not (RS.Fields.Item("answer3").Value = "n/a") then %> <tr> <td>C) <input type="checkbox" name="<%= "question" & (RS.Fields.Item("id").Value) & "c" %>" value="True"> <%=(RS.Fields.Item("answer3").Value)%> <%'if (RS.Fields.Item("a3").Value) then Response.Write(" (correct)")%> </td> </tr> <% end if %> <% if not (RS.Fields.Item("answer4").Value = "n/a") then %> <tr> <td>D) <input type="checkbox" name="<%= "question" & (RS.Fields.Item("id").Value) & "d" %>" value="True"> <%=(RS.Fields.Item("answer4").Value)%> <% 'if (RS.Fields.Item("a4").Value) then Response.Write(" (correct)")%> </td> </tr> <% end if %> <% if not (RS.Fields.Item("answer5").Value = "n/a") then %> <tr> <td> <p> E) <input type="checkbox" name="<%= "question" & (RS.Fields.Item("id").Value) & "e" %>" value="True"> <%=(RS.Fields.Item("answer5").Value)%> <%' if (RS.Fields.Item("a5").Value) then Response.Write(" (correct)")%></p> </td> </tr> <% end if %> <tr> <td> <p> </p></td> </tr> <% end if RS.MoveNext() Wend %> <tr> <td><input type="submit" name="Submit" value="Grade Test"></td> </tr> <input type="hidden" name="test_to_take" value=" "> </form> </table> </br></div></td></tr></table></td></tr></table> </body> </html> <% RS.Close() %><!--#include file="test_close.asp" -->
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)