I have a button on my webpage that executes a python script and am trying to create another one that executes javascript and then the python script.
However, I can't get it to do both. It will either send out the email or change the button.
<script type="text/javascript">
var alertTimerId = 0;
function alertTimerClickHandler ( )
{
if ( document.getElementById("alertTimerButton").value == "RESTART" )
{
// Start the timer
document.getElementById("alertTimerButton").value = "RESTARTING PLEASE WAIT......";
alertTimerId = setTimeout ( "showAlert()", 3000 );
}
else
{
document.getElementById("alertTimerButton").value = "RESTART";
clearTimeout ( alertTimerId );
}
}
function showAlert ( )
{
alert ( "process has been restarted" );
document.getElementById("alertTimerButton").value = "RESTART";
}
</script>
<!-- <form name="update" method="post" >
<button onclick="alertTimerClickHandler()" name = "clickMe" value= "RESTART" id="alertTimerButton" > RESTART </button>
</form> -->
<form action=index.php method= "get">
<input type="button" name="clickMe" id="alertTimerButton" value= "RESTART" onclick="alertTimerClickHandler()" />
</form>
<?php
if (isset($_GET['clickMe']))
{
exec("/anaconda3/bin/python /Users/restartemail.py \"$input_val\"");
} else{
}
?>
my code that works is
<form name="update" method="post" >
<button name = "update" type="submit"> Send Update Email </button>
if (isset($_POST['update']))
{
exec("/anaconda3/bin/python /Users/sendemail.py \"$input_val\"");
}