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 Link to comment https://forums.phpfreaks.com/topic/169667-solved-sessions/ 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? Link to comment https://forums.phpfreaks.com/topic/169667-solved-sessions/#findComment-895124 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... Link to comment https://forums.phpfreaks.com/topic/169667-solved-sessions/#findComment-895128 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?? Link to comment https://forums.phpfreaks.com/topic/169667-solved-sessions/#findComment-895215 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); Link to comment https://forums.phpfreaks.com/topic/169667-solved-sessions/#findComment-895244 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 Link to comment https://forums.phpfreaks.com/topic/169667-solved-sessions/#findComment-895327 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.