How do I set unlimited time to a cookie for a session? I have tried the following below but I still get undefined index notices on my sessions after a day:
s
You must add an expiry date, or the cookie will act like a session and expire when you leave the website,
what you're doing is nearly right but you need to change it slightly;
You are setting expire 9999999999 (you need to specify a UNIX TIMESTAMP in the future), so i use the following:
$inTwoMonths = 60 * 60 * 24 * 60 + time();
setcookie('idcourse', 'CourseID', $inTwoMonths );
setcookie('namecourse', 'CourseName', $inTwoMonths );
setcookie('id', 'ID', $inTwoMonths );
will make the cookie expire in 2 months, you can increment this accordingly.