Welcome Guest, Not a member yet? Register   Sign In
getting the cookie values
#1

[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
#2

[eluser]designfellow[/eluser]
Hi,
use cookie name like this.
get_cookie($username)
it will work.

Happy Coding,
DesignFellow
#3

[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'.
#4

[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.
#5

[eluser]mrcoder[/eluser]
still iam not getting the values.
#6

[eluser]designfellow[/eluser]
Hi,
try without the if condition.
If it works, check the $remember variable.
#7

[eluser]designfellow[/eluser]
Hi,
try without the if condition.
If it works, check the $remember variable.




Theme © iAndrew 2016 - Forum software by © MyBB