note 8618 added to header

From: Date: Thu, 21 Sep 2000 09:17:35 +0000
Subject: note 8618 added to header
Groups: php.notes 
Request: Send a blank email to php-notes+get-5269@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 http://www.php.net/manual/function.header.php

« previous php.notes (#5269) next »