I want a PHP file to
A) disable submit button until page has been fully loaded and also while PHP script is actively running.
B) Allow a single PHP script to distinguish what form was submitted to it, so it can run different code for different form submissions.
C) Allow form to be submitted to any specified PHP script, whether it be an external file or a script on its own file.
<!DOCTYPE html>
<html lang = "en-US">
<head>
<title>Super Awesome Title!</title>
<meta charset = "UTF-8"/>
<?php
if(isset($_POST['SubmitButton']))
{
echo "Hello from PHP!";
}
?>
<script type = "text/javascript">
function disableSubmit1()
{
document.getElementById("submitbutton_1").disabled = true;
}
</script>
</head>
<body>
<form id="zipform" onsubmit="disableSubmit1()" method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>">
<input type="submit" id="submitbutton_1" name="SubmitButton" value="Test"/>
</form>
</body>
</html>
Solved
I have found the solution to my problem. --> https://github.com/dougpurinton/disable_button_javascript/blob/master/disable_button_correct.php