I am trying to get the cookie value by its name. This is the first time i am using the cookie in codeigniter .
Here is how i am trying to get the cookie value which i have set, but its show output in my view page as bool(false)
How i am setting cookie into my controller....
$ranum=random_string('alnum', 20);//generates random numbers/strings
$cookie = array(
'name' => 'remember_me_token',
'value' =>$ranum,
'expire' => '1209600', // Two weeks
'domain' => base_url(), //my base url is http://localhost
'path' => '/'
);
set_cookie($cookie);
How i am trying trying to get my cookie value is
<?php echo $this->input->cookie('remember_me_token', TRUE); //giving output like bool(false) ?>
Note: i am using ajax when users click the "submit" button
Please help me how to check if cookie is available with this name, if its available then how to retrieve its value into my view page..
Update: I checked my browser cookies,its looking like this...its seems i have problem in setting cookie. If so then please help me why my cookie is not setting?