getting the cookie values - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: getting the cookie values (/showthread.php?tid=21655) |
getting the cookie values - El Forum - 08-17-2009 [eluser]mrcoder[/eluser] Hi, Iam new to codeigniter i want to set cookie if user checks the remember me. i have set the cookie like this $usercookie=set_cookie($username, $password, '86500'); and iam now trying to get tthe cookies $getusercookie=get_cookie($usercookie); the cookies are setting property but iam not able to get them.iam getting the null values when iam using get_cookie .can any one tell me whats the problem in my code getting the cookie values - El Forum - 08-17-2009 [eluser]designfellow[/eluser] Hi, use cookie name like this. get_cookie($username) it will work. Happy Coding, DesignFellow getting the cookie values - El Forum - 08-17-2009 [eluser]Festy[/eluser] You are not going to get anything in $usercookie. The cookie value can only be fetched using cookie name, which in your case is '$username'. getting the cookie values - El Forum - 08-17-2009 [eluser]mrcoder[/eluser] if($remember){ $cookie1 = array( 'username' => $username, 'password' =>$password, 'expire' => '86500', ); set_cookie($cookie1); get_cookie('username','true'); get_cookie('password'); } i have written like this but iam not getting the values in cookies.iam getting null values. getting the cookie values - El Forum - 08-17-2009 [eluser]mrcoder[/eluser] still iam not getting the values. getting the cookie values - El Forum - 08-17-2009 [eluser]designfellow[/eluser] Hi, try without the if condition. If it works, check the $remember variable. getting the cookie values - El Forum - 08-17-2009 [eluser]designfellow[/eluser] Hi, try without the if condition. If it works, check the $remember variable. |