PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
You can create a link with that value as a parameter and have the user click the link to send a request with the value to the server (and PHP). Or use Ajax to send a request with the value.
PHP files mostly generate HTML that is sent to the browser. In the code above, the <script> code will be run in the browser. So you need to send the value back to the server with a GET or POST request.