Welcome Guest, Not a member yet? Register   Sign In
issue in setting cookie
#1

[eluser]Unknown[/eluser]
Sorry if i have posted in wrong forum.
Am very new to Codeingnater, i want to set the cookies for country and city for our users. I have followed the procedure given in the manual.

$country = $this->input->post('country');
$cookie = array(
'name' => 'country',
'value' => '$country',
'expire' => time()+86500,
'domain' => '.example.mysite.com',
'path' => '/',
'prefix' => '',
);
set_cookie($cookie);
But unable to set the cookie...?
#2

[eluser]Dennis Rasmussen[/eluser]
Don't add time() to your expiration.
set_cookie() adds your specified seconds to the current time already.

If you don't need a prefix, path or a domain-wide cookie, then don't add them.
Only the name and value are required.

Code:
set_cookie('country', $country, 86500);
#3

[eluser]Unknown[/eluser]
it work fine :coolhmm:
but i have facing another issue...
actually i am making website for iphone mobile..
now cookies work fine in my computer but it not set the cookie in iphone mobile....




Theme © iAndrew 2016 - Forum software by © MyBB