You can use isset()
.
<form method="post">
<input type="submit" name="test" id="test" value="RUN" />
</form>
<?php
function testfun()
{
echo "Your test function on button click is working";
}
if(isset($_POST('submit')))
{
testfun();
}
?>