interaction between two pages...
Posted: Fri Nov 14, 2003 1:44 am
Ok, I have 2 webpages that i have a popquiz type website on..
On page 1 i will post a question, then the user selects and answer
and hits the submit button, and it goes to page 2 to see if the answer was correct.
Then after user clicks next button on page2 we go back to page 1 and
it displays the 2nd question and so on....
My problem is i need a good way to keep the user from using the back button to go to previous questions. It causes problems because i keep track in a database of what question they are on.
My unsuccessful attempt at a solution i've thought of so far is the following:
Page1: In the onclick event for the button to check the answer I set a session variable so that I could check on the next page if the variable was set, then set it to NULL on page 2.
Page2: Same thing, for the next button to go to next question, i set a different session variable in the onclick event so i could check on the next page if the variable was set, then set it to null on page1.
See where i'm going? If I hit the back button from page 2 to page 1, then I was thinking the session variable would not have been set since it was in the onclick action for the button.
However, this approach is not working...
Is there any good suggestions for how to handle this? I'm pretty new at php and web page stuff.. Using session variables might be off the wall for this, its just what came to my head.
Thanks,
On page 1 i will post a question, then the user selects and answer
and hits the submit button, and it goes to page 2 to see if the answer was correct.
Then after user clicks next button on page2 we go back to page 1 and
it displays the 2nd question and so on....
My problem is i need a good way to keep the user from using the back button to go to previous questions. It causes problems because i keep track in a database of what question they are on.
My unsuccessful attempt at a solution i've thought of so far is the following:
Page1: In the onclick event for the button to check the answer I set a session variable so that I could check on the next page if the variable was set, then set it to NULL on page 2.
Page2: Same thing, for the next button to go to next question, i set a different session variable in the onclick event so i could check on the next page if the variable was set, then set it to null on page1.
See where i'm going? If I hit the back button from page 2 to page 1, then I was thinking the session variable would not have been set since it was in the onclick action for the button.
However, this approach is not working...
Is there any good suggestions for how to handle this? I'm pretty new at php and web page stuff.. Using session variables might be off the wall for this, its just what came to my head.
Thanks,