note 18974 deleted from ref.session by sniper

From: Date: Sun, 28 Jul 2002 01:03:15 +0000
Subject: note 18974 deleted from ref.session by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-33766@lists.php.net to get a copy of this message
The current documentation on the use of $_SESSION in favour of session_register() omits to mention that registering your variables in the manner: $_SESSION['cheese']='salmon'; does *NOT* implicitly start a session in the way that you might expect: session_register($cheese); to. This is not mentioned in the documentation, and the statement about not mixing use of $_SESSION and older session functions leads you to believe it should be handled automagically. In fact you must explicitly call session_start() before you assign/retrieve values to/from $_SESSION, eg: session_start(); if (!isset($_SESSION['loggedIn'])) { $_SESSION['loggedIn']=false; } elseif ($_SESSION['loggedIn']) { #Extra code if user logged in }

« previous php.notes (#33766) next »