I am new to php. I am trying to check if the session variable has a value? If yes do nothing else set value. This is my code:
if (isset($_POST['ProductName'])) {
if (!empty($_SESSION['UserBasketID'])) {
$order = $_POST['ProductName'];
$date = date("Ymd");
$_SESSION['UserBasketID'] = $date.$order;
var_dump($_SESSION['UserBasketID']);
} else {
echo 'The session is set';
if (isset($_SESSION['UserBasketID'])) {
var_dump($_SESSION['UserBasketID']);
}
}
}
And can somebody tell me how it works in php.