So what you want is for the user to click a button on the server side and then for some event to happen on the web server? If so, then you don't need Javascript. This is just a normal FORM.
For example, if you want the user to be able to add items to a database on the web server, you would do it this way:
Create two files: The first one (let's call it page1.html) is pure HTML like this:
<form action="page2.php" method=post">
Product Name: <input type=text name="productname"><br>
Price: <input type=text name="price">
<input type=submit value="Add this to the database on the web server">
</form>
Then you have a second file (called page2.php) that receives the data when the user clicks the submit button. The PHP inside this file will execute whenever the user clicks the button on their client side machine.
The PHP in page2.php might look like this:
<?php
$productname=$POST['productname'];
$price=$POST['price'];
$sql = "INSERT INTO shop (productname,price) VALUES ('$productname','$price')";
$result = mysql_query($sql);
?>
<B>Thanks, we have added that item to the database on the web server</B>
So you see, the HTML on the client's machine had a form action that pointed at a second script. The contents of the form were passed up to the web server (remotely) and the second script (page2.php) processed the PHP commands.
The key is that the PHP commands run on the web server. You use this model whenever you want the user's click on their client machine to invoke some PHP action on the web server, not on the client's machine itself.