To make a HTML button to call a PHP function, you will have to move your function to a PHP file, then make your button to call it with Ajax.This is how a button calls a PHP function : Ajax does all the magic. Hello I want to execute bb() function on button click. I have a dojo Button object that I want to execute a .php file when it is clicked. The php script runs a query and constructs a .xls file from it that it then prompts the user to download or open. I am trying to execute a bash script on my server from a radio button and submit button on my web page. There are two radio buttons and each will execute a different bash script (test1.sh test2.sh).