note 8618 deleted from header by ronabop

From: Date: Thu, 28 Sep 2000 15:29:06 +0000
Subject: note 8618 deleted from header by ronabop
Groups: php.notes 
Request: Send a blank email to php-notes+get-5549@lists.php.net to get a copy of this message
I am trying to set a cookie, and then redirect to another page, like this: setcookie ("USER", $username); header ("Location: login.php"); It seems I can only do one or the other. The above code redirects the browser to the login.php page, but the cookie does not get set; if I comment out the header(...) line, it does. (I know, because my browser warns me before accepting cookies). Thinking that header() kills any previous output, I also tried this: header ("Set-Cookie: USER=$username"); header ("Set-Cookie: PASS=$passwd"); header ("Location: login.php"); Same story, with the 'Location' header the cookies don't work; without it, they do. (both of them) It seems the 'Location' header precedes all other headers. Any ideas? Thanks, Aleko

« previous php.notes (#5549) next »