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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to