I know its possible but I dont seem to be able to do it.
Anyone with suggestions, or an example would be greatly appreciated
Thanks
passing a javascript variable into a php variable??
Moderator: General Moderators
- CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany
Normally you don't pass a javascript variable to php without a page reload. Remember that once a PHP script has run, no actions on it are possible via PHP without resending the page.
What I imagine you are asking can be achieved by changing form values (input fields etc) using javascript and submitting the form so PHP can read it as a GET or POST variable and process it as required.
Note: The gap between Javascript and PHP is narrowing but that is definately outside the scope of this post. Example explanation (http://www.sitepoint.com/blog-post-view.php?id=191776)
What I imagine you are asking can be achieved by changing form values (input fields etc) using javascript and submitting the form so PHP can read it as a GET or POST variable and process it as required.
Note: The gap between Javascript and PHP is narrowing but that is definately outside the scope of this post. Example explanation (http://www.sitepoint.com/blog-post-view.php?id=191776)