Possible Duplicate:
How to pass value from javascript to php file
would something like this work?
<script>
var a;
a = 5;
<?php
$b = ?>a;
</script>
I am wondering if I can have javascript parsed by the client-side and have the output information be picked up by PHP as a variable that can be used elsewhere.
You could actually have your JS parsed with PHP if you:
e.g.:
You’d also need to have a PHP include or at least the relevant code to populate the required variables.
Note it’s best practice to not use PHP short-tags – your php.ini should be configured to not allow them. i.e., do this:
instead of this: