Session's getting lost?
Posted: Mon Dec 29, 2008 11:18 am
Hi, I have tried to solve this prob myself but couldn't, please help me out here..
This is the code:
The above code works just fine... The problem comes when I try to access this associative array in another file. Let's say this is first file:
And now let's say that this is page 2.php
Why does it give error "Undefined variable: _SESSION"??
This is the code:
Code: Select all
<?php
session_start();
$_SESSION['name']='dexter';
echo $_SESSION['name'];
?>
Code: Select all
<?php
session_start();
$_SESSION['name']='dexter';
?>
<a href="page2.php">Go to this page</a>
Code: Select all
<?php
echo $_SESSION['name'];
?>