You have a basic misunderstanding about how cookies work.  The first time
you load up your page nothing is set and you issue:

 setcookie("C_name",$name);
 setcookie("C_email",$email);

Since $name and $email are empty, this will generate these SetCookie
headers in the response:

Set-Cookie: C_name=deleted; expires=Tue, 13-Mar-01 15:30:14 GMT
Set-Cookie: C_email=deleted; expires=Tue, 13-Mar-01 15:30:14 GMT

ie. it deletes the cookies unless $name and $email are set.

Now, when $name and $email are set, then of course these cookies will be
sent.  But sending a cookie during a request doesn't affect the current
request in any way.  A cookie is only effective on the subsequent request
when the browser decides to send it back to you.  You obviously cannot
receive the cookie in the request that generated it.  Universal rules of
causality are working against you here.

To summarize, there is absolutely no bug here.

-Rasmus

On Wed, 13 Mar 2002, Andy Woolley wrote:

> Hi All,
>
> I think I might have found a bug with cookies but I'm not sure if what is
> happening is actually a bug or a feature. I personally think it's a bug but
> there might well be a perfectly valid answer to this situation that I'm not
> seeing.
>
> If I have a cookie set and I then change the value of that cookie, changes
> are not being reflected in the cookie until a page refresh. In other words,
> if I change the value of a cookie the value contained inside the cookie name
> does not get updated with the new value.
>
> It's quite hard to explain so I created a little demo to try out at
> http://www.milonic.co.uk/cookietest.php If you enter some info in there you
> should the problem.
>
> I'm trying this out on 4.1.0 and 4.1.2 on Linux 7.2
>
> There is a workaround for this by declaring the value in the cookie variable
> but I still think that the cookie should be updated when it is set.
>
> I apologise if this has been dealt with and explained in the past.
>
> Cheers
> Andy
>
>
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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

Reply via email to