<% ' Detect whether users household has already answered survey based on cookie in cache ' If they have already answered then redirect them to page to let them know ' If Request.Cookies("Survey") = "True" Then Response.Redirect "p3_householdComplete.asp" %> Beanie Kids Survey <% If Request.Querystring("QC") = "" Then Response.Redirect "p2_questionnaire.asp?QC=1" Set Con = Server.CreateObject("ADODB.Connection") Set rsQuery = Server.CreateObject("ADODB.Recordset") Path = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" Path = Path & Server.MapPath("survey.mdb") & ";Mode=ReadWrite;Persist Security Info=False" Con.Open Path Set rsQuery = Con.Execute("SELECT * FROM QDB ORDER BY ID ASC") i = 0 While Not rsQuery.EOF i = i + 1 rsQuery.MoveNext Wend %> " method="post"> <% Set rsQuery = Con.Execute("SELECT * FROM QDB ORDER BY ID ASC") For x = 1 To (Request.Querystring("QC") - 1) rsQuery.MoveNext If rsQuery.EOF Then Response.Redirect "error.asp?cs=Wrong querystring data. Possible cause: Manually edited?" Next Multiple = rsQuery("MultipleChoices") %> <% Set rsQuery = Con.Execute("SELECT * FROM ADB WHERE QuestionID=" & rsQuery("ID") & "") While Not rsQuery.EOF %>
Question <%= Request.Querystring("QC") %> of <%= i %>
<%= rsQuery("Question") %>
  <% If Multiple = True Then %> "> <% Else %> "> <% End If %> <%= rsQuery("Answer") %>
<% 'Loop do display all answer options for each question rsQuery.MoveNext Wend %> <% 'If the current question is 3 then display image related to that question If Request.Querystring("QC") = 3 Then %>
<% 'If the current question is 4 then display image related to that question ElseIf Request.Querystring("QC") = 4 Then %>
<% 'If the current question is 5 then display image related to that question ElseIf Request.Querystring("QC") = 5 Then %>
<% End IF %>
<% 'Tests whether Previous Button is show If Request.Querystring("QC") > 1 Then %> "> <% End IF %>