Forum Moderators: open
On the question page, I have created the following loop to create the questions:
[1]
While Not QRS.EOF
QuestionCounter = QuestionCounter + 1
%><b><%Response.Write (QuestionCounter)%>. <%
Response.Write QRS("Question")%></b><br><%
If QRS("Response1") <> "" Then %>
<input type="radio" name="<% Response.Write (QuestionCounter) %>" value="Response1"> <% Response.Write QRS("Response1")
Else
End If
If QRS("Response2") <> "" Then %>
<br><input type="radio" name="<% Response.Write (QuestionCounter) %>" value="Response2"> <% Response.Write QRS("Response2")
Else
End If
If QRS("Response3") <> "" Then %>
<br><input type="radio" name="<% Response.Write (QuestionCounter) %>" value="Response3"> <% Response.Write QRS("Response3")
Else
End If
If QRS("Response4") <> "" Then %>
<br><input type="radio" name="<% Response.Write (QuestionCounter) %>" value="Response4"> <% Response.Write QRS("Response4")
Else
End If
If QRS("Response5") <> "" Then %>
<br><input type="radio" name="<% Response.Write (QuestionCounter) %>" value="Response5"> <% Response.Write QRS("Response5")
Else
End If
If QRS("Response6") <> "" Then %>
<br><input type="radio" name="<% Response.Write (QuestionCounter) %>" value="Response6"> <% Response.Write QRS("Response6")
Else
End If
%><br><br><%QRS.MoveNext
Wend [/1] So, as you can see, it will pull the questions from the database and create radio buttons for the responses. Some questions only have 2 responses (yes/no), while others have up to six. And, the radio buttons are named off of an QuestionCounter variable, which is auto-incremented.
So, on my results page, I would like to create another loop that will use an autocounter to pull the values from my form. The only problem is when I use Request.Form, I have to put the item I'm requesting in quotes...but if I'm using a variable, I can't use quotes. For example, this is what I've tried to do:
[1]
Dim Q1Res, currentquestion
currentquestion = 1
Q1Res = Request.Form(currentquestion)
[/1] However, it doesn't pull the value from my first question (valued at one). But if I make it like this:
[1]
Dim Q1Res
Q1Res = Request.Form("1")
[/1] Then it will work, but I can't use that in a loop. You see my predicerment? I would GRATEFULLY accept any ideas or recommendations. If you have further questions or need clarification, please let me know. Thank you!