CodeIgniter Forums
problem with a cookie - 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: problem with a cookie (/showthread.php?tid=43028)



problem with a cookie - El Forum - 06-27-2011

[eluser]nourdine[/eluser]
hello

I am setting a cookie in a certain controller and then trying to retrieve it in another one. To set it I do:

Code:
$this->input->set_cookie(array(
          "name" => "user_email",
          "value" => $this->loginAttempt->getEmail(),
          "expire" => "3600", // 1 hour!
          "secure" => true
      ));

which works fine as firebug is concerned. The cookie "user_email" is there and I can see it!

But when I move to the new action (a different page basically) I cannot retrieve it and I get a FALSE when I do:

Code:
$email = $this->input->cookie("user_email");
var_dump($email);

which is weird cuz as in this new page too, firebug is still able to see the cookie.

Anybody??

cheers


problem with a cookie - El Forum - 06-27-2011

[eluser]nourdine[/eluser]
Sorry guyz can you at least confirm that cookies are working in CI?


problem with a cookie - El Forum - 06-27-2011

[eluser]Nick_MyShuitings[/eluser]
yes cookies do work... I've just tried a similar example in my reactor 2.0.2 and it works like a charm... do you have a test link perhaps?