Re: Cookies

From: Date: Thu, 24 Aug 2000 16:41:51 +0000
Subject: Re: Cookies
References: 1  Groups: php.general php.windows 
Request: Send a blank email to php-general+get-13463@lists.php.net to get a copy of this message
JtB> Hi all, JtB> I'm having trouble with cookie use; JtB> In this php script of mine I set a cookie : JtB> setcookie($cook_ID,$randval,time()+3600,".",".ourdomain.com"); JtB> Now when I want to start another script, the current script stays PHP_SELF JtB> and so the other script will not take over the value from the cookie; JtB> Even when I open this script manually the php_info won't show the cookie JtB> vars... Jeroen: How do you start the other script ? If you include() it or require() it, the cookie will not be visible. You need to do a redirect, with header("Location: other.php") or some other way, to this other script, so that the cookie will be sent back by the browser and made visible to the script. From the PHP Manual, XX. HTTP Funtions, setcookie: " Common Pitfalls: Cookies will not become visible until the next loading of a page that the cookie should be visible for. " Saludos, Pablo Vera

« previous php.general (#13463) next »