Robert Meyer wrote:
"Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]

Robert Meyer wrote:

Hello,

Scenario:
1) User is presented a blank form.
2) User fills in form.
3) User submits form.
4) Record is added to database.
5) Back to 1).

Go really back to 1) - use redirect. After the record is added to the database, use something like:
header('Location: http://yourserver.com/form.php');
exit;


Does this work for all browsers?

yes.



All is fine to here.
6) User clicks refresh.
7) Another record is added, same data except auto-increment field.
How do I prevent these last two steps, or at least prevent a record
from being added when refresh is clicked?

You should see a message from your browser that data is being reposted.


I looked for such a message and the only thing I can find is as follows:

1) _SERVER['HTTP_ACCEPT'] and _ENV['HTTP_ACCEPT'] and change to "*/*", but I don't know if that is the case for all browsers, do you know?

2) _SERVER['REDIRECT_UNIQUE_ID'] and _ENV['REDIRECT_UNIQUE_ID'], _SERVER['REMOTE_PORT'] and _ENV['REMOTE_PORT'], _SERVER['UNIQUE_ID'] and _ENV['UNIQUE_ID'] change, but I don't think the values are predictable, especially between browsers.

Do you know of a specific message to look for and is that message the same for all browsers?

that's a message the user (using the browser) gets from the browser. Unless you use GET method, but you should really use POST method for forms that change state on the server.






-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to