This is a discussion on Refreshing in forms using post within the PHP General forums, part of the PHP Programming Forums category; Suppose I have a form. Upon submission, the metadata is posted to a processing script (a separate PHP file), which ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Suppose I have a form. Upon submission, the metadata is posted to a
processing script (a separate PHP file), which parses it and then sends the user back to a particular page using the header function. If said user clicks their browser's back button, the aforementioned processing script will re-parse that post data and create a duplicate record. How can I prevent this? Cache control? Thanks, -- Matt Grimm Web Developer The Health TV Channel, Inc. (a non - profit organization) 3820 Lake Otis Parkway Anchorage, AK 99508 907.770.6200 ext. 686 907.336.6205 (fax) E-mail: mgrimm@healthtvchannel.org Web: www.healthtvchannel.org |
|
|||
|
What header are you using? If you use Location header, this should not
happen. Matt Grimm wrote: > Suppose I have a form. Upon submission, the metadata is posted to a > processing script (a separate PHP file), which parses it and then sends the > user back to a particular page using the header function. If said user > clicks their browser's back button, the aforementioned processing script > will re-parse that post data and create a duplicate record. How can I > prevent this? Cache control? > > Thanks, > -- > Matt Grimm > Web Developer > The Health TV Channel, Inc. > (a non - profit organization) > 3820 Lake Otis Parkway > Anchorage, AK 99508 > 907.770.6200 ext. 686 > 907.336.6205 (fax) > E-mail: mgrimm@healthtvchannel.org > Web: www.healthtvchannel.org > |
|
|||
|
Hello Matt,
Monday, December 1, 2003, 10:31:23 PM, you wrote: MG> Suppose I have a form. Upon submission, the metadata is posted to a MG> processing script (a separate PHP file), which parses it and then sends the MG> user back to a particular page using the header function. If said user MG> clicks their browser's back button, the aforementioned processing script MG> will re-parse that post data and create a duplicate record. How can I MG> prevent this? Cache control? There is no 100% reliable method of controlling the cache of any browser. Why not, in your processing script, set a flag or issue something to the users session to the effect of "already submitted this form". Then if they do click back and submit it all again you can check for the existence of this value and give them a nice friendly error message ("Thanks for your enthusiasm, but you've already done this!") :) -- Best regards, Richard mailto:rich@launchcode.co.uk |