[PHP] setcookie().. how to retrieve data afterward?
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] setcookie().. how to retrieve data afterward?
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- ___ Jack Sasportas Innovative Internet Solutions Phone 305.665.2500 Fax 305.665.2551 www.innovativeinternet.com www.web56.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] setcookie().. how to retrieve data afterward?
cheers Jack but Ive tried this and get the error msg: Warning: Undefined variable: user_id in C:/XITAMI/webpages/netrux/intothemain.php on line 14 so its not setting the varible by the looks of it any ideas? cheers Jack Sasportas wrote in message [EMAIL PROTECTED]... 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- ___ Jack Sasportas Innovative Internet Solutions Phone 305.665.2500 Fax 305.665.2551 www.innovativeinternet.com www.web56.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]