gwinz Posted August 10, 2009 Share Posted August 10, 2009 Using PHP 5.2.2 and can't seem to get sessions to work... <?php session_start(); echo session_id(); //newloginm.php $morl=1; $_SESSION['morl']='1'; $_SESSION['color']='red'; ?> ________________ <?php session_start(); //Page2.php $color = $_SESSION['color']; echo "this Session is " . $color . "<BR>"; echo "the User is M or L " . $_SESSION['morl'] . "<BR>"; echo session_id(); ?> I am getting the session id on both pages...but not the color or morl ??? Am I doing something wrong? Thanks GARY Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted August 10, 2009 Share Posted August 10, 2009 I am getting the session id on both pages Perhaps a silly question, but just to check...you're getting the same session ID? Quote Link to comment Share on other sites More sharing options...
gwinz Posted August 10, 2009 Author Share Posted August 10, 2009 Yes same id on page one as page two... Quote Link to comment Share on other sites More sharing options...
gwinz Posted August 11, 2009 Author Share Posted August 11, 2009 Is there anyone using Sessions?? This is driving me crazy!!!! What am I doing wrong?? Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted August 11, 2009 Share Posted August 11, 2009 Add the following two lines of code immediately after your first opening <?php tag on both pages (move the session_start() statement down so it is after these two lines of code) - ini_set("display_errors", "1"); error_reporting(E_ALL); Quote Link to comment Share on other sites More sharing options...
gwinz Posted August 11, 2009 Author Share Posted August 11, 2009 I found the problem... The php.ini file on the server didn't have the correct session.save_path set. I edit the file and corrected the path and all is ok. Thanks to all Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.