![]() |
|
![]() | ||
|
Subject:
HTML/PHP form submission error: how to prevent repeat posts?
Category: Computers > Programming Asked by: g8z-ga List Price: $10.00 |
Posted:
19 Mar 2003 17:29 PST
Expires: 20 Mar 2003 07:25 PST Question ID: 178486 |
hello, I have several HTML forms on a remotely-hosted website that are processed by PHP scripts. The form data is entered into a MySQL database. Occassionally, after submitting a form I get the following message: "Warning: Page has Expired The page you requested was created using information you submitted in a form. This page is no longer available. As a security precaution, Internet Explorer does not automatically resubmit your information for you. To resubmit your information and view this Web page, click the Refresh button. " If the Refresh button is clicked, then the form is resubmitted. Without getting into the details of the application, such duplicate form submissions are very problematic. Is there any way, perhaps using Javascript, PHP, or other technologies (MySQL?) that can prevent the form from being resubmitted upon refresh? E.g. flushing out the HTTP_POST_VARS somehow upon page refresh? Or preventing the message from appearing (maybe redirecting the user to another page?) Thanks, Darren |
![]() | ||
|
There is no answer at this time. |
![]() | ||
|
Subject:
Re: HTML/PHP form submission error: how to prevent repeat posts?
From: popsracer-ga on 20 Mar 2003 02:36 PST |
The typical way to solve this problem is to have PHP generate a unique identifier as a hidden field in the form. Then add a field to the database to hold the unique identifier. Before the new entry is added to the database the PHP script checks to make sure that the unique identifier is not already in the database. If it is already in the database then you either discard the new details or overwrite the existing database entry depending on what you want to do. Check out the following link which details about how to generate a unique identifier. http://www.zend.com/manual/function.uniqid.php |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |