TonyLoco23
06-01-2009, 11:50 AM
I have a dynamic asp webpage to display a simple quiz.
The quiz that is displayed on the page can vary, and depends on a variable that is passed into the URL. The variable is QuizID:
i.e.
"www.myWebsite.com/quizPage.asp?QuizID=2"
On the bottum of the webpage there is a submit button called "Submit Answers".
For some reason when the user submits the answers by pressing on this button, the QuizID is lost. Even though the form action specificies the quizID for the refresh
i.e.
"<form action="QuizPage.asp?QuizID=<%=QuizID%>" method="get" name="formQuiz">"
I can see that when the page refreshes after the submit button is pressed, the webpage URL no longer has the QuizID value.
I tried with both method="post" and method="get" but neither work.
How can I get the page to remember the quizID, one ugly way would be to store the QuizID in a hidden textbox or in a session variable, but there must be a simpler, cleaner way???
Below is the code stripped down to its simplest form:
<%
dim QuizID
quizID = request.querystring("QuizID")
%>
<form action="QuizPage.asp?QuizID=<%=QuizID%>" method="get" name="formQuiz">
'(LONG CODE THAT PULLS THE QUIZ FROM A DATABASE AND DISPLAYS IT HERE HAS BEEN OMMITTED)
<input name="SubmitQuiz" type="submit" id="SubmitQuiz" value="Submit Answers"/>
</form>
The quiz that is displayed on the page can vary, and depends on a variable that is passed into the URL. The variable is QuizID:
i.e.
"www.myWebsite.com/quizPage.asp?QuizID=2"
On the bottum of the webpage there is a submit button called "Submit Answers".
For some reason when the user submits the answers by pressing on this button, the QuizID is lost. Even though the form action specificies the quizID for the refresh
i.e.
"<form action="QuizPage.asp?QuizID=<%=QuizID%>" method="get" name="formQuiz">"
I can see that when the page refreshes after the submit button is pressed, the webpage URL no longer has the QuizID value.
I tried with both method="post" and method="get" but neither work.
How can I get the page to remember the quizID, one ugly way would be to store the QuizID in a hidden textbox or in a session variable, but there must be a simpler, cleaner way???
Below is the code stripped down to its simplest form:
<%
dim QuizID
quizID = request.querystring("QuizID")
%>
<form action="QuizPage.asp?QuizID=<%=QuizID%>" method="get" name="formQuiz">
'(LONG CODE THAT PULLS THE QUIZ FROM A DATABASE AND DISPLAYS IT HERE HAS BEEN OMMITTED)
<input name="SubmitQuiz" type="submit" id="SubmitQuiz" value="Submit Answers"/>
</form>