Skip to content Skip to sidebar Skip to footer

Php Doesn't Process The Form

I'm having a little problem here. I have a form with a jQuery that disables the submit input when the form is submited.The problem is: I use PHP to process the data when the input

Solution 1:

Since you are disabling the submit button it will not get send over to to server in the $_POST variable so your code doesn't work, as you have said.

Another way to do what you are looking for is to create a hidden HTML input

<inputtype="hidden" name="form">

Then when you check if the form is send, you will use

if(isset($_POST['form']))
{
    //Do things
}

Solution 2:

You can solve it easily changing your submit button by a simple button:

<form class='send' action='{$_SERVER['PHP_SELF']}' method='post'>
    <!--Form data-->
    <inputtype='button'name='finish'value='Send'/>
</form>

$('input[name="finish"]', '.send').on('click', function(){
    $(this).prop('disabled', true);
    $('.send').submit();
});

Post a Comment for "Php Doesn't Process The Form"