How to prevent a form from submitting on page refresh? [duplicate]
Possible Duplicate:
How do I stop the Back and Refresh buttons fr开发者_如何学Pythonom resubmitting my form?
I have a form that like most forms submits every time the user refreshes the page. Is there any way to prevent this so the form submits ONLY when the submit button is clicked and at no other times?
the best plan is to do a header redirect after the form is processed.
e.g.
header('Location: http://www.example.com/');
Even if you redirect to the same url, refreshing won't resubmit the form
After the form is submitted, the server should redirect to some other page or even to the same page, but without any POST parameters.
Then the user can refresh the redirected page and it won't submit anything.
精彩评论