Welcome Guest, Not a member yet? Register   Sign In
I have problem with set cookie in codeigniter
#2

[eluser]Matias Perrone[/eluser]
mr.hongphuoc,

This is not a bug, this is a pure PHP problem. You can access the cookies in the next load if you want to save the "LANG" as it was a cookie set it when you call the "setcookie" function, so:

Code:
if (!isset($_COOKIE['LANG']))
{
setcookie('LANG', 'en', time()+86500,'/','');
$_COOKIE['LANG'] = 'en';
}

Check PHP Manual for the setcookie: http://www.php.net/manual/en/function.setcookie.php, it says "Once the cookies have been set, they can be accessed on the next page load".

Best!


Messages In This Thread
I have problem with set cookie in codeigniter - by El Forum - 10-15-2012, 12:12 AM
I have problem with set cookie in codeigniter - by El Forum - 10-15-2012, 02:31 PM
I have problem with set cookie in codeigniter - by El Forum - 10-17-2012, 08:59 AM



Theme © iAndrew 2016 - Forum software by © MyBB