Form is resubmitted when the back button is pressed

懵懂的女人 提交于 2021-02-07 14:20:24

问题


I have a problem with my contact form that I have made using HTML and PHP. When the user clicks submit it redirects to another page where the user gets the message, "Your message has been sent". It then automatically redirects to the home page. But when the user clicks the back button, the message appears again and the form is resubmitted. Consequently I get two identical messages sent to my email!

How can I fix this?


回答1:


Take a look at Preventing form resubmission and Prevent Back button from showing POST confirmation alert where you will find useful info how to make redirects which won't trigger form re-submission when the Back button is clicked.



来源:https://stackoverflow.com/questions/11377259/form-is-resubmitted-when-the-back-button-is-pressed

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