Use the onclick() event listener in the button to call a Javascript function that will call the PHP function Note that if any variables are declared as GLOBAL in the PHP function, they must be assigned values before the Javascript function is parsed by the HTML interpreter