You are here: Re: setcookie not working « All PHP « IT news, forums, messages
Re: setcookie not working

Posted by Andy Hassall on 09/25/06 23:00

On Tue, 26 Sep 2006 00:50:14 +0200, "Frits van Leeuwen" <fleeuwen@wanadoo.nlx>
wrote:

>I call from index.php this file: (Taal_nl)
>
><?php
>setcookie("LeeuwendeelTaal", "nl", time()+3600*24); // 1 dag
>echo "Cookie is: ". $_COOKIE["LeeuwendeelTaal"] . '<br>';
>echo "Cooke is: ". $LeeuwendeelTaal;
>header('Location: http://www.Leeuwendeel.info/index.php');
>exit;
>?>
>
>nothing happend.
>
>when I remake lins. like this:
><?php
>setcookie("LeeuwendeelTaal", "nl", time()+3600*24); // 1 dag
>echo "Cookie is: ". $_COOKIE["LeeuwendeelTaal"] . '<br>';
>echo "Cooke is: ". $LeeuwendeelTaal;
>/* header('Location: http://www.Leeuwendeel.info/index.php');
>exit; */
>?>
>
>I see this:
>Cookie is:
>Cooke is:
>
>after refresh I see:
>Cookie is: nl
>Cooke is: nl
>
>I like to see this, without a refresh.

You can't, that's not how it works. $_COOKIE is only populated when the
browser sends the cookie back to the server, which is only on the next request.

--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

 

Navigation:

[Reply to this 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

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