RE: [PHP] Test for Cookies

From: Date: Wed, 24 Jan 2001 19:56:03 +0000
Subject: RE: [PHP] Test for Cookies
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-36462@lists.php.net to get a copy of this message
You'll need to at least reload the page so the cookie can be sent back to the server after it's set..... Try this: it's taken directly from the annotations on the setcookie function page of the php manual. <?php $status = 0; if (isset($myTstCky) && ($myTstCky == "ChocChip")) $status = 1; if (!isset($CCHK)) { setcookie("myTstCky", "ChocChip"); header("Location: $PHP_SELF?CCHK=1"); exit; } ?> <html> <head><title>Cookie Check</title></head> <body bgcolor="#FFFFFF" text="#000000"> Cookie Check Status: <?php printf ('<font color="#%s">%s</font> ;', $status ? "00FF00" : "FF0000", $status ? "PASSED!" : "FAILED!"); ?> </body> </html> > -----Original Message----- > From: Karl J. Stubsjoen [mailto:karlflips@kstub.com] > Sent: Wednesday, January 24, 2001 1:42 PM > To: brian@gfx.cncdsl.com; PHP Mailing List > Subject: Re: [PHP] Test for Cookies > > > > By trying to set a cookie and read it back. > > Okay....here is the scenario: > > User originates from STATIC Html page, > Links to my PHP Cookie Test Page > I set a cookie in my PHP Cookie Test Page > Can I then check (safely) for cookies right away in my PHP Cookie > Test Page > without involving a 3rd page? > > Karl > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#36462) next »