I have just started with php and need some help to understand.
These lines below do not work properly as I had imagined
if (isset ($_GET['submit']) && empty ($_SESSION['basket'])){
$ _SESSION['basket'] = array($_GET['product'], $_GET['price'], $_GET['number']);
print_r ($_SESSION['basket']);
}elseif (isset ($_GET['submit'])) {
echo "already submitted";
}
The first time you press submit, the basket is empty, which means that the first code is running. But the second time I press submit, it should not be empty anymore? But still, it does not run the other code.
What have I missed? Please give me some tips
Aucun commentaire:
Enregistrer un commentaire