Re: Cookies problem
| From: | Greg Kelley | Date: | Fri, 14 Jan 2000 12:41:12 +0000 |
| Subject: | Re: Cookies problem | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-14619@lists.php.net to get a copy of this message | ||
Try formatting your setcookie to:
setcookie("LOG",$logname,"/",$SERVER_NAME,0);
----- Original Message -----
From: Mukul Gandhi <mgandhi@bhartitelesoft.com>
To: <php-dev@lists.php.net>
Sent: Friday, January 14, 2000 5:18 AM
Subject: [PHP-DEV] Cookies problem
> Hello ,
>
> In a PHP script, I want to set the cookies on the client *and* also
> redirect control to another page say "www.php.net". To achieve this I am
> writing the code -
> header("Location: http://www.php.net");
> setcookie("LOG",$logname);
> setcookie("PASS",$passwd);
>
> The problem with this code is that cookies are not getting set. But the
> control is going to the page www.php.net.
> On the other hand if I am removing the line header("Location:
> http://www.php.net");
> cookies are getting set !
>
> I think problem is because cookies are sent with HTTP headers so setcookie
> method does not work with header function.
>
> Can somebody tell me the way to "both redirect control to the page and
also
> set the cookies" ?
>
> with regards
> -mukul
>
>
> --------------------------------------------------------------
> Bharti Cellular Limited, New Delhi, India
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
> For additional commands, e-mail: php-dev-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>