note 49081 added to function.session-start

From: Date: Sun, 16 Jan 2005 09:39:31 +0000
Subject: note 49081 added to function.session-start
Groups: php.notes 
Request: Send a blank email to php-notes+get-83400@lists.php.net to get a copy of this message
If you're using $_COOKIE and $_SESSION to pass values from one page to another, do not use the same keys ! For example: <page1.php> <? session_start(); // $_COOKIE['key1']="foo"; $_SESSION['key1']="bar"; print($_COOKIE['key1']); //this will display "foo" print($_SESSION['key1']); //this will display "bar" // ?> <page2.php> <? session_start(); // print($_COOKIE['key1']); //this will display "foo" print($_SESSION['key1']); //this wont display anything!! // ?> It took me hour to understand ---- Manual Page -- http://www.php.net/manual/en/function.session-start.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+49081 Delete -- http://master.php.net/manage/user-notes.php?action=delete+49081&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49081&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+49081&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+49081&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+49081&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+49081&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+49081&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#83400) next »