Jump to content

[SOLVED] Preventing back/forward button form resubmission


phpknight

Recommended Posts

I have a site that is form intensive and would like to prevent users on my site from resubmitting forms when they press back or forward, which they will likely do at some point no matter how I program it. 

 

So, I am interested from hearing from people who 1) had the same need and 2) implemented something in PHP with which they were satisfied.  How did you go about doing this?

 

Please do not respond unless you have actually done this in practice and not theory.  ;)

use a seperate script where you do the submitting... you have the form in one page and then you action it to anohter page, which do the database update, or what ever you want to do, then you redirect to the last page.

 

Very nice and simpel solution... the way i am doing it, anyways :)

Hmm.  Looks like I might be stuck.  I generally like to just redisplay the same form with the information + error messages and let them resubmit to get it right.  Could I have something just as user friendly but also implement the redirect?

use sessions if you want the data the user put in, to be saved after you have run the validate script...

 

########

formscript.php

 

action="validate.php"

########

 

 

########

validate.php

 

validate information

if not validated -> set sessions

redirect to formscript.php

 

########

 

 

########

formscript.php

use the session information if the session are set. (If the sessions are set this would mean that the data was not validated).

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.