Re: Setcookie() and header()

From: Date: Wed, 15 Jan 2003 05:34:49 +0000
Subject: Re: Setcookie() and header()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-131658@lists.php.net to get a copy of this message
Unless I am mistaken, the typical behavior for most browsers is exactly as you described. Which is due to the browser receiving a Location header and acting on it, disregarding any other headers. (ex: cache/no-cache, cookies, etc) Anybody care to prove me wrong? While not the best route, you could alternatively use a meta-refresh for the redirect. This would give you the chance for the headers to be read and the cookie created. Hope that helps, Jason k Larson J. Alden Gillespy wrote:
After I set a cookie and then send a redirect header, the cookie doesn't show up, but the browser successfully redirects. setcookie("test", "blahblah", time() + 1440); header("Location: http://www.mywebsite.com/login.php"); However, if I take out the header() statement, then the cookie is successfully set. Anyone else having this problem? J. Alden Gillespy (aka Dogga) Microsoft Beta Tester: - Office 11 - Content Management Server (CMS) 2002 - Systems Management Server (SMS) 2003


« previous php.general (#131658) next »