note 55606 added to function.session-start

From: Date: Mon, 08 Aug 2005 19:01:15 +0000
Subject: note 55606 added to function.session-start
Groups: php.notes 
Request: Send a blank email to php-notes+get-93268@lists.php.net to get a copy of this message
Many people were having trouble with PHP losing $_SESSION on header redirect. Most of the examples did not set a session id. Before session_start() remember to put a session_id, this way it sets the information to a place, and then calls on it from the same place. page 1 <?php session_id('8675309'); session_start(); $_SESSION['username']="USERNAME"; header(redirect......); ?> page2 <?php session_id('8675309'); session_start(); echo $_SESSION['username']; ?> this way will not lose the data since you are telling it where to go and calling on it from the same place. ---- Manual Page -- http://www.php.net/manual/en/function.session-start.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+55606 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55606&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55606&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55606&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55606&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55606&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55606&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+55606&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#93268) next »