I tried William's code, thanks brother.
but it doesn’t work like a simple button, I have to add a form with the method = "post". Also I have to write submit instead of a button.
here is my code below ..
<form method="post">
<input type="submit" name="test" id="test" value="RUN" /><br/>
</form>
<?php
function testfun()
{
echo "Your test function on button click is working";
}
if(array_key_exists('test',$_POST)){
testfun();
}
?>
source
share