Monthly Archives: May 2020

Prevent form submitted twice

Sometimes there is issue we got double records in the database due to the form submitted twice.

Here is the way how to prevent it. A simple way

if (!$_SESSION['post_data'] == $_POST)
// process the data
// after success process, set the session to post value
    $_SESSION['post_data'] = $_POST;
// display a message that the form already submitted.