Re: Can't send cookie and redirect together (php3/IIS)
| From: | Andy Warwick | Date: | Fri, 09 Jun 2000 19:56:21 +0000 |
| Subject: | Re: Can't send cookie and redirect together (php3/IIS) | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-365@lists.php.net to get a copy of this message | ||
on 1/6/00 9:13 pm, editor at editor@yellowjournal.org wrote:
> I'm trying to set a cookie and redirect to a new page. I've tried:
>
> setcookie("cookieName",$value,);
> header ("Location: http://www.foo.com");
>
> It does the redirect, but doesn't set the cookie. If I comment out the
> redirect, it sets the cookie. If I switch the order of the lines it
> does the redirect before it ever gets to the cookie line. I tried
> combining the cookie and the redirect into a single "header()" call, but
> couldn't find a syntax that works.
>
> I know this should be simple, but I can't get it. Any suggestions?
I too was having this problem, and found the following note on php.net:
"There are several references to a bug when header("Location:") is used in
conjunction with setcookie. Several comments talk about this happening in
IE4.
It's not an IE4 bug, it's an IIS bug. The bug also appears to exist in IIS 5
(Windows 2000). The bug is documented in KB article Q176113.
http://support.microsoft.com/support/kb/articles/q176/1/13.asp
I found that using <META http-equiv="Refresh" content="0;URL:your URL">
seems to work as an alternative."
Hope that eases the frustration :)
--
Andy Warwick andy.w@creed.co.uk