Re: headers and session

From: Date: Mon, 06 Jun 2005 15:52:10 +0000
Subject: Re: headers and session
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-216494@lists.php.net to get a copy of this message
* "Alessandro Rosa" <zandor_zz@yahoo.it>: > Hi to all, > > I got a problem while storing session variables. > > <?php > session_start(); > header( "Cache-control: private" ); > > require_once("config.inc.php"); > > //////////////////////////////////////////////////////////// > $_SESSION['session_psw'] = $_POST['txtPassword']; > $_SESSION['session_user'] = $_POST['txtIdUtente']; > > //////////////////////////////////////////////////////////// > > $PHPcmd = $GLOBALS['gestionale_path_name']."test/2.php" ; > > header( "Location: ".$PHPcmd ); > > ?> > > After the call to header(...), the values of session variables are lost. Does config.inc.php have any whitespace following the closing ?> tag, or does it output any HTML? That could be your culprit. What happens if you do your $_SESSION setting *before* the require, but directly after the initial header() call? -- Matthew Weier O'Phinney | WEBSITES: Webmaster and IT Specialist | http://www.garden.org National Gardening Association | http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org mailto:matthew@garden.org | http://vermontbotanical.org

« previous php.general (#216494) next »