Remeber: php does not exist on the client side and javascript doesn't exist on the server side.
You have two main options:
1 - if it's a form you can use that to send values to a php file (for rendering) on the server and it will come back to the client with the value having been made available.
2 - AJAX - the better way - it lets you use javaScript to send things to the server without affecting the current page (unless you want to).
Now - once on the server side you need to do what you wish with it and, if it's part of what you need to do, create the new information on the client as HTML, javaScript, etc.
AJAX Introduction[
^]