Re: losing session variable

From: Date: Mon, 07 May 2007 19:18:01 +0000
Subject: Re: losing session variable
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-254508@lists.php.net to get a copy of this message
On 5/6/07, Alain Roger <raf.news@gmail.com> wrote:
if i check before header command what is the value of $_SESSION['username'], i get the right value. however, if i place on the first line of welcome.php file the following code : echo "<br>1. Before session"; session_start(); echo"<br>Username : ".$_SESSION['username']; echo "<br>2. After session"; i get empty value for this session variable. How is it possible ?
You have to execute the session_start method before any data have been sent to the client. You are sending data to the browser with 'echo "<br>1. Befor Session";' -- Saludos Oscar

« previous php.general (#254508) next »