Reply to Re: [PHP] Re: here is the problem again

Your name:

Reply:


Posted by M. Sokolewicz on 10/06/44 11:11

Chris W. Parker wrote:

> AndreaD <mailto:andrea.davidson@silene.co.uk>
> on Tuesday, March 22, 2005 12:25 PM said:
>
>
>>The cookie will not/set or print out.
>>http://www.aztechost.com/problem.phps
>
>
> setcookie("cookie[$name]", $age);
> echo $_COOKIE[$name];
>
> I think it should be:
think again
>
> setcookie("cookie[$name]", $age);
> echo $_COOKIE['cookie[{$name}]'];
>
> ??
>
> Please see http://www.php.net/setcookie.
have you tried reading it yourself? the answer /is/ in there you know!
Basically, what happens here is the fact that when you set a cookie
using setcookie(), that cookie isn't automatically added to the $_COOKIE
superglobal. why not? because the $_COOKIE superglobals array contains
cookies *recieved* from the user, and this one just left on its way *to*
the user. Until the user reloads the page, that cookie will not show up
in the $_COOKIE array. But, please tell me, why don't you print it like
this:
echo $age ?

-tul
>
>
> Also you're teaching yourself a very bad habit of writing scripts with
> register_globals turned on. See google for more information.
>
>
> Chris.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация