开发者

How to prevent a form from submitting on page refresh? [duplicate]

This question already has answers here: Closed 12 years ago.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜