Brent,
you're dealing with a language that is intended for server-side applications.
First of all, do you understand how the client-server technology works? Client (browser) sends a request to the server. Server runs php script, waits until the full completion of the script and the send the output back to the client. There is no immediate interaction between the client machine and server machine. If user press a button, he does it on the client machine, and at this moment there is no link with server machine or script whatsoever.
Perhaps you should look into Java applets, if you nees some interaction on client side.