Andy Woolley wrote:
> Ok, I hear what you are saying and accept that it isn't a bug but is it not
> possible to populate the cookie variable when you set the cookie.
> I have had many problems with cookies & PHP in the past, usually due to the
> way they work and so anything that can be done to make cookies easier to use
> would be of benefit.

wouldn't you be better off with php sessions instead of putting stuff
into cookies yourself?

> If I use JavaScript to manipulate cookies, as soon as the cookie is set I
> can access it and I would imagine this behaviour to also be present in PHP
> and as it is not, it causes much confusion.

JavaScript is executed on client side, PHP runs on the server side

important difference in this case

> I appreciate that this is not of prior importance but I've just spent quite
> a long time trying to figure out why my cookies were not behaving as they
> perhaps should have. As Sander pointed out from the manual "Cookies will not
> become visible until the next loading of a page that
> the cookie should be visible for.". I think this could do with being looked
> into at some stage. I personally think the cookie should be available as
> soon as it is set.

a cookie is transfered to the clients browser using a "Set-Cookie:"
line in the HTTP response header
you do not know in advance if a client will accept cookies,
and the client will only return the cookie on the next request
(if at all)

so it perfectly makes sense that a cookie is *not* visible in
the php script it is first set in
automagicaly setting the value in $_COOKIE[] or even as a global
variable with register_globals=on would cause more confusion than
it would help

again: please try to understand how the HTTP protocol in general
and especialy the Cookie mechanism work

for cookie specification see
http://www.netscape.com/newsref/std/cookie_spec.html
(as mentioned on http://php.net/setcookie)

for HTTP 1.1 see http://www.w3.org/Protocols/rfc2616/rfc2616





-- 
Hartmut Holzgraefe  [EMAIL PROTECTED]  http://www.six.de  +49-711-99091-77

Wir stellen für Sie aus auf der CeBIT 2002 und freuen uns
in Halle 6 auf Ihren Besuch am Stand H 18


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to