I need my cart page to show a summary "line item" like view of all vending machines purchased on my vend page with $_SESSION['cart']
Here is my code which allows me to add multiple items to the cart: (Vend Page)
session_start();
//Check if $_SESSION['cart] exists
if (!isset($_SESSION['cart'])) {
//initiate cart as empty array
$_SESSION['cart'] = [];
}
if (isset($_POST['add'])) {
//add product id to session cart
$_SESSION['cart'][$_POST['add']] =1;
}
else if (isset($_POST['remove'])) {
//remove product id from session cart
unset($_SESSION['cart'][$_POST['remove']]);
}
I just need a way to display the items I "Add to Cart" on the Vend Page" to display in a list onto another page "Cart page". Ive made an image to show how it should be displayed: HERE