Shopping Website
Items For Sale
Shopping Cart
session_start();
$action = $_GET['action'];
if ($action == "Clear") {
session_destroy();
unset($_SESSION);
}
else if ($action == "Undo") {
array_pop($_SESSION['cart']);
}
else if (isset($_GET['item'])) {
$item = $_GET['item'];
$_SESSION['cart'][] = $item;
}
for($i = 0; $i < sizeof($_SESSION['cart']); $i++){
echo '- '.$_SESSION['cart'][$i].'
';
}
?>