Re: setcookie().. how to retrieve data afterward?
| From: | Jack Sasportas | Date: | Sun, 01 Apr 2001 18:31:00 +0000 |
| Subject: | Re: setcookie().. how to retrieve data afterward? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-46514@lists.php.net to get a copy of this message | ||
If you just echo $userid you will get the results.
do this
setcookie ("cookie_variable", "chocalate chip", 1, "", "",
1);
echo $cookie_variable
You can name the cookie_variable whatever you want and that will be referenced
as the variable to store "chocalate chip".
Now if you want to see the value from within a function you will need to also do
this:
global $HTTP_COOKIE_VARS;
this will enable you to see the values stored in the cookies.
Andrew Rose wrote:
> Ive been playing with setcookie() and am stuck with trying to re-pull the
> infomation I set, I use:
>
> setcookie ("user_id", $userid, 1, "", "", 1);
>
> to set the cookie and:
>
> if(isset( $user_id )){
> echo " cookie 'user_id': $user_id\n";
> } else
>
> echo" no cookie set ...\n";
> }
>
> to see if its there.. now this is the closest Ive seen anyone else do it and
> to me it dosnt make much sense at all the code for retrieving.. also it
> dosnt work.. suprise suprise.. so anyone know how to do this?
>
> thanks in advance
>
> -Andrew Rose
>
> --
> 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
--
___________________________________________________________
Jack Sasportas
Innovative Internet Solutions
Phone 305.665.2500
Fax 305.665.2551
www.innovativeinternet.com
www.web56.net