I want to run a PHP function with an HTML button click.
I can call a PHP script this way:
This is a little complicated. You can either submit the form to itself, check to see if the post variable is set (if it is, then the page is being run because the form was submitted to it), or you can use ajax. The first is an easier solution, and the second doesn't require a page reload. Pick your poison ;)
Look at this for the first solution, and look at jquery's ajax functions for the second.
This won't work. PHP is pretty much done processing by the time the user handles the page. You'd have to use AJAX to send the data to the server and retrieve the response.