I am having a problem in accessing a session variable.I have one page lets say test.php, when i use print_r($_SESSION) here, it prints all the session data.But when i use <a href="test2.php">Redirect</a> then i am unable to access session data on test2.php i-e print_r prints empty array, even though i have session_start() at the top of my script.
Then i tried header("Location: test2.php") and now session data is accessible.
But i want the page to be redirected on onClick of a button.
Please help ..
var_dump($_COOKIES);next to theprint_rof the$_SESSION. Compare the differences.var_dump($_COOKIES);print NULL$_COOKIE, my fault. It should display the session id cookie. If not, the session got lost andsession_startwill create a new session.