I am trying to disable the submit button on a form so when the user clicks it twice it won't submit it again. I know there are already a few questions here that address that, but the solutions offered don't seem to be working.
I am using the solution offered here: Disable submit button on form submit
Here's my jQuery:
$('form#proof_form').submit(function(){
$(this).children('input[type=submit]').attr('disabled', 'disabled');
});
After the submit button is pushed it is supposed to enter a saved value to a DB and then redirect to another page. Instead it is now reloading the current page without redirecting. I placed a test echo right after the user pushes the submit button and it doesn't work. Also the value is no longer posting to the DB, so I know it is disabling the submit button before it can send to the DB and redirect.
Here is my php:
if(isset($_POST['accept_proof'])){
echo 'The form was submitted!';
$sql = 'INSERT into orders SET
name = "' . $_SESSION['name'] . '"';
$conn->query($sql) or die($conn->error);
}
Why is the button not submitting after the first click?