Hi I Am Little New To Php I Am Having Some Problem Regarding The Session In Php. Here Is My Problem. As Like All Website My Aim Is To Ask For Id And Password From User And After Checking The Id And Password I Create One Session And Store User Id In One Variable To Refer To Other Page. And I Am Redirecting To Home Page After Setting Session And At That Home Page I Am Unable To Retrieve That Session Variable Data. Means My Session Is Not Persistence. Can Anyone Help Me Waiting For Reply. If Code Require Ask Me I Am Doing This On Server Lot Local Server
page 1: <?php session_start(); $_SESSION['foo'] = "bar"; ?> <a href="page2.php">goto page 2</a> PHP: page 2: <?php session_start(); echo $_SESSION['foo']; ?> PHP:
Your problem must have been in the omitance of the session_start() function, which is necessary to save and use Session Variables.