query('SELECT id,part,name,type,price,stock,images from products where part="' . $db->real_escape_string($_GET['id']) . '"')->fetch_object(); if ($_POST) { if ($_POST['quantity']) { $oldprice = $data['info']->price * $_POST['quantity']; $newprice = $oldprice + $_SESSION['product'][$data['info']->id]['amount']; $_SESSION['product'][$data['info']->id]['amount'] = $newprice; $_SESSION['product'][$data['info']->id]['quantity'] = $_POST['quantity'] + $_SESSION['product'][$data['info']->id]['quantity']; $data['success'] = true; } if ($_SESSION['product']) { $cart = null; foreach ($_SESSION as $value) { foreach ($value as $key => $two) $cart[] = $two['amount']; } } if ($cart) $data['cart'] = array_sum($cart); } $data['title'] = $data['info']->name . ' Purchase at Vital Systems Inc'; $load->view('head.php', $data); $load->view('purchase.php', $data); $data['quicksand'] = true; $load->view('foot.php', $data);