OK, you're still missing a fundamental point:
PHP is strictly server side. You can't access php variables/functions/anything once the page has been served to the browser.
When a php file is requested by a client, the server passes the file to the PHP interpreter which executes the php code and passes the resultant output to the web server to be sent to the client. Once that happens PHP is no longer a part of the picture. Those PHP variables you had are now NOT variables. They either ceased to exist OR exist ONLY as STATIC data in the HTML.
Now, that said, you can take a PHP variable and assign the value to a js variable in the php script. e.g.:
<?
// do some PHP stuff
?>
..blah
< some tag onClick=jsfunc(<? print $variable ?>)>
What happens is that PHP will replace the <? print $variable ?> with the value of $variable at the time. When it reaches the client it will look like:
< some tag onClick=jsfunc(25)>
if the value of $variable was 25.
The only way you can call a php function based on user input in the client is to make another request to the server.
As, to your question about multiple users. You've delved into the <irony>wonderful</irony> world of STATE.
Web pages are stateless, meaning that they is no way a server can know which client is requesting the page and maintain server information for that client in and of itself. That's up to you to do. You have to pass some sort of information via a cookie, the url in an a href link or in a hidden form field back to the server so that your script there can determine the identity of the client. You used to be able to do this with header information (IP address, etc) but no longer. Maintaining this state is called session management. If you are using PHP4, you can use the built in session management (see the manual for more info). If not you can use an off the shelf component called PHPLIB (PHP4's session management is based on that) or you can roll your own. Session management is nothing more than assigning a unique identifier to each user. Each subsequent request to the server from the same client would pass back that identifier and you can use that in your scripts as an index to store information about the client/user in a flat file or an RDBMS such as MySQL.
HTH