Stop data inserting into a database twice

后端 未结 16 1353
再見小時候
再見小時候 2020-12-01 00:33

I was wondering what methods/preventions other programmers use to stop data being entered twice into a MySQL database when a user refreshes on the same page as a form? Obvio

16条回答
  •  渐次进展
    2020-12-01 01:02

    My two cents:

    • Redirect the user to the same page after sending data and verify if(isset($_POST['submit'])

    Other useful information for similar cases:

    • Give a look to LOCK TABLES in MySQL

    • Disable buttons via JavaScript after the first click

提交回复
热议问题