Hi, I want to set a $_SESSION with a cookie so that the session can last longer so I do not get undefined index notices in a short space of time. Is the code below correct or do I need to modify something?
$inTwoMonths = 60 * 60 * 24 * 60 + time();
setcookie('id', 'ID', $inTwoMonths);
//line 20-23
if (isset($_POST['id'])) {
$_SESSION['id'] = $_POST['id'];
}
//line 30
<?php echo $_SESSION['id'] ?>