Please help, I can't figure out why the value of session save in one page is lose when I tried to access in other page... E.g AT login.php $_SESSION['username'] =$_POST[login]; $_SESSION['password'] =$_POST[password]; Code (markup): now on logs.php echo $_SESSION['username'] ; Code (markup): value of the session variable is not showing.
remember to put a session_start(); at the top of login.php and logs.php. If you don't do it then yes the session will be lost.
It may also be worthwhile using some debug code to help you figure out whether or not your session is even being set in the first place. You could use something like: <pre> <?php echo "SESSION: <br />"; print_r($_SESSION); echo "POST: <br />"; print_r($_POST); echo "GET: <br />"; print_r($_GET); ?> </pre> Code (markup):