Page 1 of 1

Prevent user from Back and re-submit

Posted: Sun Mar 25, 2007 9:59 pm
by hoangvu.che
My site flow is as follows:

+ step 1: page 1 for data input and submit
+ step 2: page 2 processes the data submitted and redirect to a result page

The problem is: At the result page, the user can press Back (resulting to page 1 again) and re-submit again.

Please help me a solution to prevent this?

Thanks a lot.

Posted: Sun Mar 25, 2007 10:01 pm
by Ambush Commander
If you're trying to create a "unique" submission system for something like voting, you're outta luck, man. Anything can be circumvented.

Depending on the level of protection you're looking for, you could:

* Set a cookie, indicating the user had already submitted the form
* Record the submission to the user's session
* Log the user's IP address
* Require the user to login with a valid email address

Posted: Mon Mar 26, 2007 9:16 am
by feyd
Also, look into using one-time tokens.

Posted: Mon Mar 26, 2007 9:35 am
by miro_igov
But if you want to clear the field values so when user clicks back the form to be empty you can use <imput type="text" value="" />

Posted: Mon Mar 26, 2007 9:40 am
by feyd
The browser will often remember the values that were in the fields prior to submission. Setting the value attribute doesn't alter this behavior at all.

Posted: Mon Mar 26, 2007 9:59 am
by Kieran Huggins
you could use some onload javascript to do it - I can think of 1 line of jQuery that would do the trick ;-)

Posted: Mon Mar 26, 2007 2:15 pm
by Ambush Commander
If you disable caching the form fields won't get repopulated.