Cookies problem
| From: | Mukul Gandhi | Date: | Fri, 14 Jan 2000 10:18:27 +0000 |
| Subject: | Cookies problem | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-14612@lists.php.net to get a copy of this message | ||
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