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.  ;)

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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).

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.