Re: Weirdness with setcookie() (3rd time - come on people :)
| From: | Joao Prado Maia | Date: | Tue, 14 Nov 2000 02:03:22 +0000 |
| Subject: | Re: Weirdness with setcookie() (3rd time - come on people :) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-25090@lists.php.net to get a copy of this message | ||
On Mon, 13 Nov 2000, Steve Nelson wrote:
> correct me if i'm wrong, but I think the location is your problem. the
> browser won't set the cookie until the header with the cookie
> information is sent to it. If you redirect the user to another_file.php
> it won't make a trip to the browser, in between the call to this file
> and another_file.php. So when you call another_file.php there is no
> cookie being sent to the browser. Does that make sense?
Well, it doesn't make sense, since the cookie _was_ supposed to be set
when you do a header("Location: "). PHP should and is smart enough to send
the 'Set-Cookie: ' header whenever it sees that a new page is being asked.
> What if you stored your cookie information in a session variable, then
> called setcookie() from another_file.php? Essentially storing the
> cookie information temporarily on the server until you were going to
> make the trip back to the browser and set the value in a cookie on the
> browser? I think that will solve your problem.
Again, I'm trying to discover what is wrong with this script, before I
think on changing all my back-end code related to this cookie, which would
be a real pain.
Thanks,
Joao
--
Joao Prado Maia
Web Developer
Kefta, Inc.
T: (415) 391-6881 ext 8008
F: (415) 391-7079