Originally posted by Hanlie
I'm using the following code to set javascript variables based on a user's action in a form.
How do I access the values of the javascript variables in PHP?
<select name="behaviour" class="controltext" onChange="javascript:document.select_behaviour.doNext.value='list_controls';document.select_behaviour.submit();">
Thanks
Hanlie
I'm not entirely sure what you are asking for... It looks like your code sets the value of the field doNext to "list_controls" then submits the form, correct? To access the doNext field in the next page, assuming it's a php page and you used the POST method, you can get to the variable with $POST['doNext']. If you used GET, then you can access it with $GET['doNext'].
Now... if you are looking to access the variable within the same page, then as yelvington has explained, it's not possible. Once the server has sent you the HTML document, the server has no more control over it. You have to send a command back to the server in order for PHP to do anything further.