'Dimension 2400', 'cost' => '149.50'); $products['AG3'] = array('name' => 'Macintosh G3', 'cost' => '199.50'); $products['DE510'] = array('name' => 'Dimension E510', 'cost' => '299.50'); // Include cart functions require_once('config/cart.php'); // Get the action to perform if (isset($_POST['action'])) { $action = $_POST['action']; } else if (isset($_GET['action'])) { $action = $_GET['action']; } else { $action = 'show_add_item'; } // Add or update cart as needed switch($action) { case 'add': add_item($_POST['productkey'], $_POST['itemqty']); include("cart-view.php"); break; case 'update': $new_qty_list = $_POST['newqty']; foreach($new_qty_list as $key => $qty) { if ($_SESSION['cart12'][$key]['qty'] != $qty) { update_item($key, $qty); } } include('cart-view.php'); break; case 'show_cart': include('cart-view.php'); break; case 'show_add_item': include('store.php'); break; case 'empty_cart': unset($_SESSION['cart12']); include('cart-view.php'); break; }