I am setting a cookie in my codeigniter application using the following code. Working fine .. but cookie get expires on session out.. Please help
$cookie = array(
'name' => 'tvcUsername',
'value' => $email,
'expire' => time()+86500,
'domain' => 'http://localhost/tvc',
'path' => '/',
'prefix' => '',
);
$this->input->set_cookie($cookie);
Thanks in advance
Two things I can think of:
a) localhost is not a valid domain, so cookies won't be saved for all browsers. Create yourself a HOST for "my.dev.server" or "localhost.dev" and point to 127.0.0.1 (you may also need to configure apache to respond to that name - but try it first just changing the HOSTS file first)
b) In addition, your "domain" includes a scheme and a path - that might be causing problems? Set to "localhost.dev" (drop the "http://" and the "/tvc" parts - once you've moved away from localhost.