I want to pass a variable set by the user to the setcookie
function.
I would like to let user change the color of some parts of website. so far the information about color is sent to server with $_SESSION['colorcode']
and I would like to add it to setcookie
as well so when the user logs in to the site next time, his/her color is there.
I've got this code:
setcookie(
'colorcode',
$_SESSION['colorcode'],
time() + 60 * 60 * 24 * 30,
'',
'',
false,
true
);
I would like to save the value of variable in cookie, but it works just for the session. what is wrong? how to do it so the color is there when the user logs in? I'm looking for another way than storing it in database or file.