Jump to content

Cookie not setting


squiblo

Recommended Posts

I have a page called 'change_language.php' and all that is in the page is this....

 

$lang = $_GET['lang'];
setcookie('language',$lang,time()+86400);

if (isset($_COOKIE['language']))
header('location: http://localhost/');

 

the page does redirect suggesting that the cookie has been set because of the if statement, but when I get to the redirected page I test if the cookie has been set by putting...

 

echo $_COOKIE['language'];

 

and nothing is echoed suggesting the cookie has not been set.

 

Link to comment
https://forums.phpfreaks.com/topic/197189-cookie-not-setting/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.