Welcome Guest, Not a member yet? Register   Sign In
Why aren't my cookies working?
#1

[eluser]dkindler[/eluser]
Im trying to learn how to deal with cookies. For some reason, It's not working for me. Any ideas?

Here's the code:

Code:
function update_user_data() {
  $this->input->setcookie("logged_in", "hi", time()+7200);
  echo $_COOKIE['logged_in'];
}


It won't write "hi"
#2

[eluser]CroNiX[/eluser]
Because the cookie doesn't actually get written until the content is sent to the browser. So, you would need to refresh the page or load a new one in order to be able to read it.




Theme © iAndrew 2016 - Forum software by © MyBB