Reputation: 51
I want to know if there is a way to access the variables set by php using java-script, so that on one page the php variables are set. And then on the next page, i can use java-script to interrogate the PHP file in order to extract the variables, so that they can be displayed on another page?
Thanks in advance!
Upvotes: 0
Views: 995
Reputation: 2484
The only way, you would do it, is by setting cookies from PHP (or Javascript), and access these.. You can access cookies via PHP using $_COOKIE['var']
, and via Js by, document.cookie("var")
Upvotes: 0
Reputation: 2813
Not sure if this works, works for my get and post variables
var mySessionVariable = "<?php echo $_SESSION['sessionVariable']; ?>";
Upvotes: 2