views:

43

answers:

2

Possible Duplicate:
How do I stop the Back and Refresh buttons from 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?

+2  A: 

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.

zvonimir
+1  A: 

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

Jonathan Fingland