Re: Getting info from Cookie

From: Date: Wed, 15 Aug 2001 22:26:49 +0000
Subject: Re: Getting info from Cookie
Groups: php.db 
Request: Send a blank email to php-db+get-11391@lists.php.net to get a copy of this message
"Cato Larsen" <ravenno1@world-online.no> wrote: >How can you extract a certain form of info from a >Cookie? > >Im my case the cookie name is "crispy". It has been >stored with a session id >and a charnick. > >How do I extract the charnick and use it in the page >as "$charnick" or >similar? That depends on how you store the data in the cookie. I find it comfortable to store the elements of the cookie separated by pipes - '|'. e.g: setcookie('crispy', $session_id . '|' . $charnick, etc'); This way you have a reference point to every element of the cookie. So in the script you can just do this: $cookie_data = explode('|', $crispy); $session_id = $cookie_data[0]; $charnick = $cookie_data[1]; --- Regards, Boaz Amit

« previous php.db (#11391) next »