Forum Moderators: coopster
Many projects I'm involved with have form sections (more than one form pages). When a user completes one form page there's a "Next >" SUBMIT button which, when pressed, triggers a validation routine - if everything passes validation, the user is served the next page.
When a user is on the second (or third, or fourth) page of a form section, each of these pages also has a "< Back" SUBMIT button. if they click that, all information in the current page is saved to $_Sessions and the user is transported back to the previous page without any information loss or anything getting screwed up.
My problem, is that when a user has already submitted a form and then presses the back or refresh button on the browser, funny things begin to happen to the information previously submitted - Sessions get over-written, etc. I think this is because the back button re-displays get vars in the URL line from the previous page.
Anyway, I think that I can deal with this if there's a way that I can detect that the browser back button or refresh button has been pressed: if I can detect this, then maybe I can use some other function to strip out any get vars in the URL before the page is re-displayed - I don't know if that's possible, but it's a thought.
So... is there a way in PHP to detect the activation of the back and refresh buttons?
If not, is there a way to de-activate these buttons when a user is working within a form section (I know this isn't a very good "usability" choice, but I need a fall-back position if there's no way to detect these buttons being pressed).
All advice greatly appreciated.
Neophyte
blahblah.php?arg=val&time=1123434235
Then, if you are presented with a page load you can test as follows:
if ($_SESSION[time]!=$_GET[time])
And then erase the old $_GET values:
$_GET="";