Reputation: 550
I am trying to pass a graph object from jpgraph from one page to another. To pass the object to the next page, I save it as $_SESSION['graph']
.
To pass the session to the next page, I add it to the URL with
echo '<a href="...../next.php?SSID='.session_id().'">Next</a>';
In next.php, I get the SID and start the session:
session_id($_GET['SSID']);
session_start();
But when I try to access $_SESSION['graph']
, I get the error Undefined index: graph and subsequently, it crashed when I try to call the Stroke()
function.
What am I doing wrong?
Upvotes: 0
Views: 65
Reputation: 158090
The default behaviour is that the session id will be stored in cookies and not in GET vars. This is controlled by the following php.ini values:
session.use_cookies=1
session.use_only_cookies=1
Which both default to 1
.
So unless you have changed this, you won't need that GET var as the session id is stored in a cookie that will be passed along with request - automatically.
Just do this:
session_start(); // will get session id from cookie and resume the session
$graph = $_SESSION['graph'];
Upvotes: 2