prevent double form submission on refresh

☆樱花仙子☆ 提交于 2020-01-11 08:01:28

问题


I have a simple question. I know that I can prevent a form to re-submit itself when the user reloads the page by using the Post/Redirect/Get Pattern. But my question is, will this pattern work if I'm redirecting the user back to the same page where the form was submitted? I mean, I don't want to redirect the user to another page.

Any help please

Thank you


回答1:


yes, but you have to remember to redirect him without the GET params.

so you can

header('Location: same_page.php?status=done');
die();

this way you are removing the param, and you need to support the status=done to show a message or what ever you want.



来源:https://stackoverflow.com/questions/7466330/prevent-double-form-submission-on-refresh

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!