I want to run a PHP function with an HTML button click.
I can call a PHP script this way:
You can have the following approaches:
1> Use AJAX to load "action.php" with the data entered in the fields as POST to the page and then take the response and put it into the body; or,
2> You cannot make it work as PHP is a server-side programming language and HTML which you are trying to use with PHP is a client side programming language. So there is no way to make it work other than AJAX.