Unset post variables after form submission

前端 未结 10 1133
礼貌的吻别
礼貌的吻别 2020-12-10 14:19

Is there a way to do the above? Basically, I don\'t want the form to be submitted again if someone presses refresh after already submitting the form once. In which case the

10条回答
  •  囚心锁ツ
    2020-12-10 15:14

    The post/redirect/get is a good option as some posters have already mentioned.

    One another way I can think of is to set a session in the dostuff.php page to indicate that the posting has already been done. Check this session var each time to see if the page is being loaded again because of a page refresh.

    
    

    In the page you redirect to, unset the session var so that the form can be resubmitted again afresh, making it a new post operation. This will allow new form posts but will prevent post operations due to page refresh

提交回复
热议问题