I have a HTML form echoed in PHP, the form action calls a PHP function. I want to disable the submit button after its been clicked without using jQuery if possible.
#PHP
echo '
<form method="POST" action="' . phpFunction() . '">
//form fields
<button name="submit" type="submit" class="btn btn-primary btn-block">Enviar</button>
</form>';
I have tried using onclick="this.disabled=true" on the button, but it prevents the PHP function from excecuting.
What should I do to excecute the function and disable the button?
actionattribute is just the path to where it will send its data, so there is really no need to make it a function.document.getElementById("btnID").disabled = true;it might help