Re: cookie problem....

From: Date: Thu, 13 Feb 2003 13:20:43 +0000
Subject: Re: cookie problem....
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-135442@lists.php.net to get a copy of this message
On Thursday 13 February 2003 16:07, Terry Lau wrote: > Hello, > I created a PHP page that included cookie, here is the PHP code: > <?php > if (isset($HTTP_POST_VARS['Name'])) { > setcookie("Name", $HTTP_POST_VARS['Name'], time()+86400*10); > } [snip] > But when I called the cookie variable in another page, it showed > "Notice: Undefined index: Name in....". Here is the PHP code in another > page: > > <html> > <head> > <title>Untitled Document</title> > <meta http-equiv="Content-Type" content="text/html; charset=big5"> > </head> > > <body> > HI!! <?php echo $HTTP_COOKIE_VARS['Name']; ?> > </body> > </html> On the page where you want to read the cookie you need to call session_start(). -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* Electrocution, n.: Burning at the stake with all the modern improvements. */

« previous php.general (#135442) next »