You could use next simple rules to avoid this problem:
1. Never change anything in your storage (database) by GET HTTP request
2. Never prepare any Web page by POST method.
3. After Form is processed (with a POST method) use HTTP redirect to
corresponding GET page which should produce a result of processing. (it
may be the same php script)
So you will have "getters" and "setters" for your Web application.
Only "getters" will be stored in a browser history in this case and
users will be able to use back/forward/reload browser functionality
without any side effects (also without requests to post data again).
PS Furthermore, such use of GET and POST methods corresponds to their
description in HTTP RFC's
With best regards,
I have a page that posts data from a form to a mysql database.
The problem is that if the user hits the reload button on the browser, the
data will be posted again, resulting in a duplicate record.
How can I avoid that?
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php