How to prevent form resubmission when page is refreshed (F5 / CTRL+R)

后端 未结 23 1786
醉话见心
醉话见心 2020-11-22 00:46

I have a simple form that submits text to my SQL table. The problem is that after the user submits the text, they can refresh the page and the data gets submitted again with

23条回答
  •  猫巷女王i
    2020-11-22 01:40

    1. Use header and redirect the page.

      header("Location:your_page.php"); You can redirect to same page or different page.

    2. Unset $_POST after inserting it to Database.

      unset($_POST);

提交回复
热议问题