PHP
<?php
session_start();
?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
</head>
<body>
<h2 align="center">SoftAOX Tutorial | Creating an Online Shopping Cart in PHP & Mysql</h2>
<?php
if(mysqli_num_rows($result) > 0)
while($row = mysqli_fetch_array($result))
?>
<div class="col-md-3">
<div style="border: 1px solid #eaeaec; margin: -1px 19px 3px -1px; box-shadow: 0 1px 2px rgba(0,0,0,0.05);
padding:10px;" align="center">
</div>
</form>
</div>
<?php
?>
<div style="clear:both"></div>
<div class="table-responsive">
<tr>
<th width="10%">Quantity</th>
<th width="5%">Action</th>
</tr>
<?php
if(!empty($_SESSION["cart"]))
$total = 0;
?>
<tr>
</tr>
<?php
?>
<tr>
<td></td>
</tr>
<?php
?>
</table>
</div>
</div>
</body>
</html>
SHOP.PHP
<?php
session_start();
if(isset($_POST["add"]))
if(isset($_SESSION["cart"]))
if(!in_array($_GET["id"], $item_array_id))
$count = count($_SESSION["cart"]);
$item_array = array(
);
$_SESSION["cart"][$count] = $item_array;
echo '<script>window.location="index.php"</script>';
else
echo '<script>window.location="index.php"</script>';
else
$item_array = array(
$_SESSION["cart"][0] = $item_array;
if(isset($_GET["action"]))
if($_GET["action"] == "delete")
if($values["product_id"] == $_GET["id"])
unset($_SESSION["cart"][$keys]);
echo '<script>window.location="index.php"</script>';
?>