General discussion
errors are shown are I change a code to view needed pictures

<?php
session_start();
error_reporting(0);
include('includes/config.php'smile;
if(isset($_POST['submit'])){
if(!empty($_SESSION['cart'])){
foreach($_POST['quantity'] as $key => $val){
if($val==0){
unset($_SESSION['cart'][$key]);
}else{
$_SESSION['cart'][$key]['quantity']=$val;

        }
    }
        echo "<script>alert('Your Cart has been Updated');</script>";
    }
}

// Code for Remove a Product from Cart
if(isset($_POST['remove_code']))
{

if(!empty($_SESSION['cart'])){
foreach($_POST['remove_code'] as $key){

            unset($_SESSION['cart'][$key]);
    }
        echo "<script>alert('Your Cart has been Updated');</script>";
}

}
// code for insert product in order table

if(isset($_POST['ordersubmit']))
{

if(strlen($_SESSION['login'])==0)
{
header('location:login.php'smile;
}
else{

$quantity=$_POST['quantity'];
$pdd=$_SESSION['pid'];
$value=array_combine($pdd,$quantity);


    foreach($value as $qty=> $val34){

mysqli_query($con,"insert into orders(userId,productId,quantity) values('".$_SESSION['id']."','$qty','$val34'smile"smile;
header('location:payment-method.php'smile;
}
}
}

?>

<!DOCTYPE html>

<html lang="en" style = "background-color: #07A612;">
<head>
<!-- Meta -->
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="description" content="">
<meta name="author" content="">
<meta name="keywords" content="MediaCenter, Template, eCommerce">
<meta name="robots" content="all">

<title>My Cart</title>
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/main.css">
<link rel="stylesheet" href="assets/css/green.css">
<link rel="stylesheet" href="assets/css/owl.carousel.css">
<link rel="stylesheet" href="assets/css/owl.transitions.css">
<!--<link rel="stylesheet" href="assets/css/owl.theme.css">-->
<link href="assets/css/lightbox.css" rel="stylesheet">
<link rel="stylesheet" href="assets/css/animate.min.css">
<link rel="stylesheet" href="assets/css/rateit.css">
<link rel="stylesheet" href="assets/css/bootstrap-select.min.css">

<!-- Demo Purpose Only. Should be removed in production -->
<link rel="stylesheet" href="assets/css/config.css">

<link href="assets/css/green.css" rel="alternate stylesheet" title="Green color">
<link href="assets/css/blue.css" rel="alternate stylesheet" title="Blue color">
<link href="assets/css/red.css" rel="alternate stylesheet" title="Red color">
<link href="assets/css/orange.css" rel="alternate stylesheet" title="Orange color">
<link href="assets/css/dark-green.css" rel="alternate stylesheet" title="Darkgreen color">
<!-- Demo Purpose Only. Should be removed in production : END -->


<!-- Icons/Glyphs -->
<link rel="stylesheet" href="assets/css/font-awesome.min.css">

<!-- Fonts -->
<link href='http://fonts.googleapis.com/css?family=Roboto:300,400,500,700' rel='stylesheet' type='text/css'>

<!-- Favicon -->
<link rel="shortcut icon" href="assets/images/favicon.ico">

<!-- HTML5 elements and media queries Support for IE8 : HTML5 shim and Respond.js -->
<!--[if lt IE 9]>
<script src="assets/js/html5shiv.js"></script>
<script src="assets/js/respond.min.js"></script>
<![endif]-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
</head>
<body class="cnt-home">



<!-- ============================================== HEADER ============================================== -->
<header class="header-style-1">
<?php include('includes/top-header1.php'smile;?>
<?php include('includes/main-header1.php'smile;?>

</header>
<!-- ============================================== HEADER : END ============================================== -->
<div class="breadcrumb">
<div class="container">
<div class="breadcrumb-inner">
<ul class="list-inline list-unstyled">
<li><a href="home.php">Home</a></li>
<li class='active'>Avail Products</li>
</ul>
</div><!-- /.breadcrumb-inner -->
</div><!-- /.container -->
</div><!-- /.breadcrumb --><?php
require_once('auth.php'smile;
?>
<!DOCTYPE html>
<html lang="en">

<head>

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">


<link rel="shortcut icon" href="logo.jpg">
<!-- Bootstrap Core CSS -->
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">

<!-- MetisMenu CSS -->
<link href="vendor/metisMenu/metisMenu.min.css" rel="stylesheet">

<!-- Custom CSS -->
<link href="dist/css/sb-admin-2.css" rel="stylesheet">

<!-- Custom Fonts -->
<link href="vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">


<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<link href="src/facebox.css" media="screen" rel="stylesheet" type="text/css" />
<script src="lib/jquery.js" type="text/javascript"></script>
<script src="src/facebox.js" type="text/javascript"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('a[rel=facebox]'smile.facebosmile{
loadingImage : 'src/loading.gif',
closeImage : 'src/closelabel.png'
})
})
</script>


</head>

<body>

<?php include('navfixed.php'smile;?>

<div id="page-wrapper">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header"><a style = "color:green;" href="home.php"><i class="fa fa-undo fa-fw"></i></a>Payment | <?php echo $_GET['id']; ?> </h1>
</div>

<div id="maintable"><div style="margin-top: -19px; margin-bottom: 21px;">
</div>
<form action="incoming.php" method="post" class = "form-group" >
<input type="hidden" name="pt" class = "form-control" value="<?php echo $_GET['id']; ?>" />
<input type="hidden" name="invoice" class = "form-control" value="<?php echo $_GET['invoice']; ?>" />

<label>Select a Product</label><br />
<select name="product" style="width:800px;" class="chzn-select" onchange="$('#imageToSwap'smile.attr('src', this.options[this.selectedIndex].value);">
<option></option>
<?php
include('connect.php'smile;
$result = $db->prepare("SELECT
FROM products"smile;
$result->bindParam(':userid', $res);
$result->execute();
for($i=0; $row = $result->fetch(); $i++){
?>
<option value="../uploads/<?php echo $row['image_location'];?>"
<?php
if($row['qty_left'] <= 0)
{
echo'disabled';
}
?>
>
<?php echo $row['product_code'];?>
Product: <?php echo $row['product_name']; ?>
- Quantity Left: <?php echo $row['qty_left']; ?>
- Price: ₱<?php echo $row['price']; ?>


</option>
<?php
}
?>
</select>


<?php if($row['image_location'] != ""smile: ?>
<img id="imageToSwap" class="profile" src="../uploads/<?php echo $row['image_location']; ?>" value = "<?php echo $row['image_location']; ?>" width="200px" height="200px" style="border:1px solid #333333;">

<?php else: ?>
<img id="imageToSwap" class="profile" src="../images/default.png" value = "<?php echo $row['image_location']; ?>"width="200px" height="200px" style="border:1px solid #333333;">
<?php endif; ?>
<br /><p> <?php echo $row['price']; ?> </p>
<label>Number of Item</label>
<input type="number" name="qty" value="1" min = "1" class = "form-control" autocomplete="off" style="width: 100px; padding-top: 6px; padding-bottom: 6px; margin-right: 4px;" />
<label>Discount</label>
<input type="text" name="discount" value="0" class = "form-control" autocomplete="off" style="width: 100px; padding-top: 6px; padding-bottom: 6px; margin-right: 4px;" readonly/>
<label>Value Add Tax:</label>
<input type="text" name="vat" value="0" class = "form-control" autocomplete="off" style="width: 100px; padding-top: 6px; padding-bottom: 6px; margin-right: 4px;" readonly/>
<br>
<input type="submit" name = "Submit" style = "background-color:green;"class="btn btn-primary" value="Add to Cart" class = "form-control" style="width: 123px;" />
</form>
<table width="100%" class="table table-striped table-bordered table-hover" id="dataTables-example">
<thead>
<tr>
<th> Product Code </th>
<th> Brand Name </th>
<th> Description Name </th>
<th> Category </th>
<th> Quantity </th>
<th> Price </th>
<th> Discount </th>
<th> VAT </th>
<th> Amount </th>
<th> Total Amount </th>
<!-- <th> Image </th>-->
<th> Delete </th>
</tr>
</thead>
<tbody>

<?php
$id=$_GET['invoice'];
include('connect.php'smile;
$result = $db->prepare("SELECT * FROM sales_order WHERE invoice= :userid"smile;
$result->bindParam(':userid', $id);
$result->execute();
for($i=0; $row = $result->fetch(); $i++){
?>
<tr class="record">
<td><?php echo $row['product']; ?></td>
<td><?php echo $row['name']; ?></td>
<td><?php echo $row['dname']; ?></td>
<td><?php echo $row['category']; ?></td>
<td><?php echo $row['qty']; ?></td>
<td>
<?php
$ppp=$row['price'];
echo formatMoney($ppp, true);
?>
</td>
<td>
<?php
$ddd=$row['discount'];
echo formatMoney($ddd, true);
?>
</td>
<td>
<?php
$fff=$row['vat'];
echo formatMoney($fff, true);
?>
</td>
<td>
<?php
$ccc=$row['amount'];
echo formatMoney($ccc, true);
?>
</td>

<td>
<?php
$dfdf=$row['total_amount'];

echo formatMoney($dfdf, true);
?>
</td>
<!-- <td>
<?php


?>
<?php if($row['image_location'] != ""smile: ?>
<img src="../uploads/<?php echo $row['image_location']; ?>" width="100px" height="100px" style="border:1px solid #333333;">

<?php else: ?>
<img src="../images/default.png" width="100px" height="100px" style="border:1px solid #333333;">
<?php endif; ?>
</td>-->


<td><a href="delete.php?id=<?php echo $row['transaction_id']; ?>&invoice=<?php echo $_GET['invoice']; ?>&dle=<?php echo $_GET['id']; ?>&qty=<?php echo $row['qty'];?>&code=<?php echo $row['product'];?>"> Delete</a></td>
</tr>
<?php
}
?>
<tr>
<td colspan="9"><strong style="font-size: 12px; color: #222222;">Total:</strong></td>
<td colspan="3"><strong style="font-size: 12px; color: #222222;">
<?php
function formatMoney($number, $fractional=false) {
if ($fractional) {
$number = sprintf('%.2f', $number);
}
while (true) {
$replaced = preg_replace('/(-?\d+)(\d\d\d)/', '$1,$2', $number);
if ($replaced != $number) {
$number = $replaced;
} else {
break;
}
}
return $number;
}
$sdsd=$_GET['invoice'];
$resultas = $db->prepare("SELECT sum(total_amount) FROM sales_order WHERE invoice= :a"smile;
$resultas->bindParam(':a', $sdsd);
$resultas->execute();
for($i=0; $rowas = $resultas->fetch(); $i++){
$fgfg=$rowas['sum(total_amount)'];
echo formatMoney($fgfg, true);
}
?>
</strong></td>
</tr>

</tbody>
</table><br>
<strong> <input type="checkbox" id="check" /> NOTE: Please be informed that the minimum purchase is ₱1000 worth of products. If not, your order will be void. <br><br>
<a rel="facebox" id="submit1" style = "background-color:green;"class = "btn btn-primary" href="checkout.php?pt=<?php echo $_GET['id']?>&invoice=<?php echo $_GET['invoice']?>&total=<?php echo $fgfg ?>&cashier=<?php echo $session_cashier_name?>&p_amount=<?php echo $ccc?>"
disabled>Check Out</a>

<div class="clearfix"></div>
</div>

</div>
</div><br><br>
<!-- /#page-wrapper -->

<script>

$('#check'smile.click(function() {
if ($(this).is(':checked'smile) {
$('#submit1'smile.removeAttr('disabled'smile;
} else {
$('#submit1'smile.attr('disabled', 'disabled'smile;
}
});

</script>

<!-- jQuery -->
<script src="vendor/jquery/jquery.min.js"></script>

<!-- Bootstrap Core JavaScript -->
<script src="vendor/bootstrap/js/bootstrap.min.js"></script>

<!-- Metis Menu Plugin JavaScript -->
<script src="vendor/metisMenu/metisMenu.min.js"></script>

<!-- Custom Theme JavaScript -->
<script src="dist/js/sb-admin-2.js"></script>

<link href="vendor/chosen.min.css" rel="stylesheet" media="screen">
<script src="vendor/chosen.jquery.min.js"></script>
<script>
$(function() {
$(".chzn-select"smile.chosen();

});
</script>

</body><?php include('includes/footer.php'smile;?>

</html>


then this is the error page

<?php
session_start();
include('connect.php'smile;
$a = $_POST['invoice'];
$b = $_POST['product'];
$c = $_POST['qty'];
$w = $_POST['pt'];
$r = $_POST['vat'];
$date = date('m/d/Y'smile;
$month = date('F'smile;
$year = date('Y'smile;

$discount = $_POST['discount'];
$result = $db->prepare("SELECT * FROM products WHERE product_code= :userid"smile;
$result->bindParam(':userid', $b);
$result->execute();
for($i=0; $row = $result->fetch(); $i++){
$asasa=$row['price'];
$name=$row['product_name'];
$dname=$row['description_name'];
$categ=$row['category'];
$qtyleft=$row['qty_left'];
}

//edit qty
$sql = "UPDATE products
SET qty_left=qty_left-?
WHERE product_code=?";
$q = $db->prepare($sql);
$q->execute(array($c,$b));
$fffffff=$asasa-$discount;
$d=$fffffff$c;
$z=$qtyleft-$c;
$vat=$d
$r;
$total=$vat+$d;
// query
$sql = "INSERT INTO sales_order (invoice,product,qty,amount,name,price,discount,category,date,omonth,oyear,qtyleft,dname,vat,total_amount) VALUES (:a,:b,:c,:d,:e,:f,:g,:h,:i,:j,:k,:l,:m,:n,:o)";
$q = $db->prepare($sql);
$q->execute(array(':a'=>$a,':b'=>$b,':c'=>$c,':d'=>$d,':e'=>$name,':f'=>$asasa,':g'=>$discount,':h'=>$categ,':i'=>$date,':j'=>$month,':k'=>$year,':l'=>$z,':m'=>$dname,':n'=>$vat,':o'=>$total));
header("location: sales.php?id=$w&invoice=$a"smile;

?>

&lt;?php session_start(); error_reporting(0); include(&#039;includes/config.php&#039;); if(isset($_POST[&#039;submit&#039;])){ if(!empty($_SESSION[&#039;cart&#039;])){ foreach($_POST[&#039;quantity&#039;] as $key =&gt; $val){ if($val==0){ unset($_SESSION[&#039;cart&#039;][$key]); }else{ $_SESSION[&#039;cart&#039;][$key][&#039;quantity&#039;]=$val; } } echo &quot;&lt;script&gt;alert(&#039;Your Cart has been Updated&#039;);&lt;/script&gt;&quot;; } } // Code for Remove a Product from Cart if(isset($_POST[&#039;remove_code&#039;])) { if(!empty($_SESSION[&#039;cart&#039;])){ foreach($_POST[&#039;remove_code&#039;] as $key){ unset($_SESSION[&#039;cart&#039;][$key]); } echo &quot;&lt;script&gt;alert(&#039;Your Cart has been Updated&#039;);&lt;/script&gt;&quot;; } } // code for insert product in order table if(isset($_POST[&#039;ordersubmit&#039;])) { if(strlen($_SESSION[&#039;login&#039;])==0) { header(&#039;location:login.php&#039;); } else{ $quantity=$_POST[&#039;quantity&#039;]; $pdd=$_SESSION[&#039;pid&#039;]; $value=array_combine($pdd,$quantity); foreach($value as $qty=&gt; $val34){ mysqli_query($con,&quot;insert into orders(userId,productId,quantity) values(&#039;&quot;.$_SESSION[&#039;id&#039;].&quot;&#039;,&#039;$qty&#039;,&#039;$val34&#039;)&quot;); header(&#039;location:payment-method.php&#039;); } } } ?&gt; &lt;!DOCTYPE html&gt; &lt;html lang=&quot;en&quot; style = &quot;background-color: #07A612;&quot;&gt; &lt;head&gt; &lt;!-- Meta --&gt; &lt;meta charset=&quot;utf-8&quot;&gt; &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;&gt; &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0, user-scalable=no&quot;&gt; &lt;meta name=&quot;description&quot; content=&quot;&quot;&gt; &lt;meta name=&quot;author&quot; content=&quot;&quot;&gt; &lt;meta name=&quot;keywords&quot; content=&quot;MediaCenter, Template, eCommerce&quot;&gt; &lt;meta name=&quot;robots&quot; content=&quot;all&quot;&gt; &lt;title&gt;My Cart&lt;/title&gt; &lt;link rel=&quot;stylesheet&quot; href=&quot;assets/css/bootstrap.min.css&quot;&gt; &lt;link rel=&quot;stylesheet&quot; href=&quot;assets/css/main.css&quot;&gt; &lt;link rel=&quot;stylesheet&quot; href=&quot;assets/css/green.css&quot;&gt; &lt;link rel=&quot;stylesheet&quot; href=&quot;assets/css/owl.carousel.css&quot;&gt; &lt;link rel=&quot;stylesheet&quot; href=&quot;assets/css/owl.transitions.css&quot;&gt; &lt;!--&lt;link rel=&quot;stylesheet&quot; href=&quot;assets/css/owl.theme.css&quot;&gt;--&gt; &lt;link href=&quot;assets/css/lightbox.css&quot; rel=&quot;stylesheet&quot;&gt; &lt;link rel=&quot;stylesheet&quot; href=&quot;assets/css/animate.min.css&quot;&gt; &lt;link rel=&quot;stylesheet&quot; href=&quot;assets/css/rateit.css&quot;&gt; &lt;link rel=&quot;stylesheet&quot; href=&quot;assets/css/bootstrap-select.min.css&quot;&gt; &lt;!-- Demo Purpose Only. Should be removed in production --&gt; &lt;link rel=&quot;stylesheet&quot; href=&quot;assets/css/config.css&quot;&gt; &lt;link href=&quot;assets/css/green.css&quot; rel=&quot;alternate stylesheet&quot; title=&quot;Green color&quot;&gt; &lt;link href=&quot;assets/css/blue.css&quot; rel=&quot;alternate stylesheet&quot; title=&quot;Blue color&quot;&gt; &lt;link href=&quot;assets/css/red.css&quot; rel=&quot;alternate stylesheet&quot; title=&quot;Red color&quot;&gt; &lt;link href=&quot;assets/css/orange.css&quot; rel=&quot;alternate stylesheet&quot; title=&quot;Orange color&quot;&gt; &lt;link href=&quot;assets/css/dark-green.css&quot; rel=&quot;alternate stylesheet&quot; title=&quot;Darkgreen color&quot;&gt; &lt;!-- Demo Purpose Only. Should be removed in production : END --&gt; &lt;!-- Icons/Glyphs --&gt; &lt;link rel=&quot;stylesheet&quot; href=&quot;assets/css/font-awesome.min.css&quot;&gt; &lt;!-- Fonts --&gt; &lt;link href=&#039;http://fonts.googleapis.com/css?family=Roboto:300,400,500,700&#039; rel=&#039;stylesheet&#039; type=&#039;text/css&#039;&gt; &lt;!-- Favicon --&gt; &lt;link rel=&quot;shortcut icon&quot; href=&quot;assets/images/favicon.ico&quot;&gt; &lt;!-- HTML5 elements and media queries Support for IE8 : HTML5 shim and Respond.js --&gt; &lt;!--[if lt IE 9]&gt; &lt;script src=&quot;assets/js/html5shiv.js&quot;&gt;&lt;/script&gt; &lt;script src=&quot;assets/js/respond.min.js&quot;&gt;&lt;/script&gt; &lt;![endif]--&gt; &lt;script src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js&quot;&gt;&lt;/script&gt; &lt;/head&gt; &lt;body class=&quot;cnt-home&quot;&gt; &lt;!-- ============================================== HEADER ============================================== --&gt; &lt;header class=&quot;header-style-1&quot;&gt; &lt;?php include(&#039;includes/top-header1.php&#039;);?&gt; &lt;?php include(&#039;includes/main-header1.php&#039;);?&gt; &lt;/header&gt; &lt;!-- ============================================== HEADER : END ============================================== --&gt; &lt;div class=&quot;breadcrumb&quot;&gt; &lt;div class=&quot;container&quot;&gt; &lt;div class=&quot;breadcrumb-inner&quot;&gt; &lt;ul class=&quot;list-inline list-unstyled&quot;&gt; &lt;li&gt;&lt;a href=&quot;home.php&quot;&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;li class=&#039;active&#039;&gt;Avail Products&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt;&lt;!-- /.breadcrumb-inner --&gt; &lt;/div&gt;&lt;!-- /.container --&gt; &lt;/div&gt;&lt;!-- /.breadcrumb --&gt;&lt;?php require_once(&#039;auth.php&#039;); ?&gt; &lt;!DOCTYPE html&gt; &lt;html lang=&quot;en&quot;&gt; &lt;head&gt; &lt;meta charset=&quot;utf-8&quot;&gt; &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt; &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt; &lt;meta name=&quot;description&quot; content=&quot;&quot;&gt; &lt;meta name=&quot;author&quot; content=&quot;&quot;&gt; &lt;link rel=&quot;shortcut icon&quot; href=&quot;logo.jpg&quot;&gt; &lt;!-- Bootstrap Core CSS --&gt; &lt;link href=&quot;vendor/bootstrap/css/bootstrap.min.css&quot; rel=&quot;stylesheet&quot;&gt; &lt;!-- MetisMenu CSS --&gt; &lt;link href=&quot;vendor/metisMenu/metisMenu.min.css&quot; rel=&quot;stylesheet&quot;&gt; &lt;!-- Custom CSS --&gt; &lt;link href=&quot;dist/css/sb-admin-2.css&quot; rel=&quot;stylesheet&quot;&gt; &lt;!-- Custom Fonts --&gt; &lt;link href=&quot;vendor/font-awesome/css/font-awesome.min.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt; &lt;!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --&gt; &lt;!-- WARNING: Respond.js doesn&#039;t work if you view the page via file:// --&gt; &lt;!--[if lt IE 9]&gt; &lt;script src=&quot;https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js&quot;&gt;&lt;/script&gt; &lt;script src=&quot;https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js&quot;&gt;&lt;/script&gt; &lt;![endif]--&gt; &lt;link href=&quot;src/facebox.css&quot; media=&quot;screen&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt; &lt;script src=&quot;lib/jquery.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt; &lt;script src=&quot;src/facebox.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt; &lt;script type=&quot;text/javascript&quot;&gt; jQuery(document).ready(function($) { $(&#039;a[rel*=facebox]&#039;).facebox({ loadingImage : &#039;src/loading.gif&#039;, closeImage : &#039;src/closelabel.png&#039; }) }) &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;?php include(&#039;navfixed.php&#039;);?&gt; &lt;div id=&quot;page-wrapper&quot;&gt; &lt;div class=&quot;row&quot;&gt; &lt;div class=&quot;col-lg-12&quot;&gt; &lt;h1 class=&quot;page-header&quot;&gt;&lt;a style = &quot;color:green;&quot; href=&quot;home.php&quot;&gt;&lt;i class=&quot;fa fa-undo fa-fw&quot;&gt;&lt;/i&gt;&lt;/a&gt;Payment | &lt;?php echo $_GET[&#039;id&#039;]; ?&gt; &lt;/h1&gt; &lt;/div&gt; &lt;div id=&quot;maintable&quot;&gt;&lt;div style=&quot;margin-top: -19px; margin-bottom: 21px;&quot;&gt; &lt;/div&gt; &lt;form action=&quot;incoming.php&quot; method=&quot;post&quot; class = &quot;form-group&quot; &gt; &lt;input type=&quot;hidden&quot; name=&quot;pt&quot; class = &quot;form-control&quot; value=&quot;&lt;?php echo $_GET[&#039;id&#039;]; ?&gt;&quot; /&gt; &lt;input type=&quot;hidden&quot; name=&quot;invoice&quot; class = &quot;form-control&quot; value=&quot;&lt;?php echo $_GET[&#039;invoice&#039;]; ?&gt;&quot; /&gt; &lt;label&gt;Select a Product&lt;/label&gt;&lt;br /&gt; &lt;select name=&quot;product&quot; style=&quot;width:800px;&quot; class=&quot;chzn-select&quot; onchange=&quot;$(&#039;#imageToSwap&#039;).attr(&#039;src&#039;, this.options[this.selectedIndex].value);&quot;&gt; &lt;option&gt;&lt;/option&gt; &lt;?php include(&#039;connect.php&#039;); $result = $db-&gt;prepare(&quot;SELECT * FROM products&quot;); $result-&gt;bindParam(&#039;:userid&#039;, $res); $result-&gt;execute(); for($i=0; $row = $result-&gt;fetch(); $i++){ ?&gt; &lt;option value=&quot;../uploads/&lt;?php echo $row[&#039;image_location&#039;];?&gt;&quot; &lt;?php if($row[&#039;qty_left&#039;] &lt;= 0) { echo&#039;disabled&#039;; } ?&gt; &gt; &lt;?php echo $row[&#039;product_code&#039;];?&gt; Product: &lt;?php echo $row[&#039;product_name&#039;]; ?&gt; - Quantity Left: &lt;?php echo $row[&#039;qty_left&#039;]; ?&gt; - Price: ₱&lt;?php echo $row[&#039;price&#039;]; ?&gt; &lt;/option&gt; &lt;?php } ?&gt; &lt;/select&gt; &lt;?php if($row[&#039;image_location&#039;] != &quot;&quot;): ?&gt; &lt;img id=&quot;imageToSwap&quot; class=&quot;profile&quot; src=&quot;../uploads/&lt;?php echo $row[&#039;image_location&#039;]; ?&gt;&quot; value = &quot;&lt;?php echo $row[&#039;image_location&#039;]; ?&gt;&quot; width=&quot;200px&quot; height=&quot;200px&quot; style=&quot;border:1px solid #333333;&quot;&gt; &lt;?php else: ?&gt; &lt;img id=&quot;imageToSwap&quot; class=&quot;profile&quot; src=&quot;../images/default.png&quot; value = &quot;&lt;?php echo $row[&#039;image_location&#039;]; ?&gt;&quot;width=&quot;200px&quot; height=&quot;200px&quot; style=&quot;border:1px solid #333333;&quot;&gt; &lt;?php endif; ?&gt; &lt;br /&gt;&lt;p&gt; &lt;?php echo $row[&#039;price&#039;]; ?&gt; &lt;/p&gt; &lt;label&gt;Number of Item&lt;/label&gt; &lt;input type=&quot;number&quot; name=&quot;qty&quot; value=&quot;1&quot; min = &quot;1&quot; class = &quot;form-control&quot; autocomplete=&quot;off&quot; style=&quot;width: 100px; padding-top: 6px; padding-bottom: 6px; margin-right: 4px;&quot; /&gt; &lt;label&gt;Discount&lt;/label&gt; &lt;input type=&quot;text&quot; name=&quot;discount&quot; value=&quot;0&quot; class = &quot;form-control&quot; autocomplete=&quot;off&quot; style=&quot;width: 100px; padding-top: 6px; padding-bottom: 6px; margin-right: 4px;&quot; readonly/&gt; &lt;label&gt;Value Add Tax:&lt;/label&gt; &lt;input type=&quot;text&quot; name=&quot;vat&quot; value=&quot;0&quot; class = &quot;form-control&quot; autocomplete=&quot;off&quot; style=&quot;width: 100px; padding-top: 6px; padding-bottom: 6px; margin-right: 4px;&quot; readonly/&gt; &lt;br&gt; &lt;input type=&quot;submit&quot; name = &quot;Submit&quot; style = &quot;background-color:green;&quot;class=&quot;btn btn-primary&quot; value=&quot;Add to Cart&quot; class = &quot;form-control&quot; style=&quot;width: 123px;&quot; /&gt; &lt;/form&gt; &lt;table width=&quot;100%&quot; class=&quot;table table-striped table-bordered table-hover&quot; id=&quot;dataTables-example&quot;&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt; Product Code &lt;/th&gt; &lt;th&gt; Brand Name &lt;/th&gt; &lt;th&gt; Description Name &lt;/th&gt; &lt;th&gt; Category &lt;/th&gt; &lt;th&gt; Quantity &lt;/th&gt; &lt;th&gt; Price &lt;/th&gt; &lt;th&gt; Discount &lt;/th&gt; &lt;th&gt; VAT &lt;/th&gt; &lt;th&gt; Amount &lt;/th&gt; &lt;th&gt; Total Amount &lt;/th&gt; &lt;!-- &lt;th&gt; Image &lt;/th&gt;--&gt; &lt;th&gt; Delete &lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;?php $id=$_GET[&#039;invoice&#039;]; include(&#039;connect.php&#039;); $result = $db-&gt;prepare(&quot;SELECT * FROM sales_order WHERE invoice= :userid&quot;); $result-&gt;bindParam(&#039;:userid&#039;, $id); $result-&gt;execute(); for($i=0; $row = $result-&gt;fetch(); $i++){ ?&gt; &lt;tr class=&quot;record&quot;&gt; &lt;td&gt;&lt;?php echo $row[&#039;product&#039;]; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $row[&#039;name&#039;]; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $row[&#039;dname&#039;]; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $row[&#039;category&#039;]; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $row[&#039;qty&#039;]; ?&gt;&lt;/td&gt; &lt;td&gt; &lt;?php $ppp=$row[&#039;price&#039;]; echo formatMoney($ppp, true); ?&gt; &lt;/td&gt; &lt;td&gt; &lt;?php $ddd=$row[&#039;discount&#039;]; echo formatMoney($ddd, true); ?&gt; &lt;/td&gt; &lt;td&gt; &lt;?php $fff=$row[&#039;vat&#039;]; echo formatMoney($fff, true); ?&gt; &lt;/td&gt; &lt;td&gt; &lt;?php $ccc=$row[&#039;amount&#039;]; echo formatMoney($ccc, true); ?&gt; &lt;/td&gt; &lt;td&gt; &lt;?php $dfdf=$row[&#039;total_amount&#039;]; echo formatMoney($dfdf, true); ?&gt; &lt;/td&gt; &lt;!-- &lt;td&gt; &lt;?php ?&gt; &lt;?php if($row[&#039;image_location&#039;] != &quot;&quot;): ?&gt; &lt;img src=&quot;../uploads/&lt;?php echo $row[&#039;image_location&#039;]; ?&gt;&quot; width=&quot;100px&quot; height=&quot;100px&quot; style=&quot;border:1px solid #333333;&quot;&gt; &lt;?php else: ?&gt; &lt;img src=&quot;../images/default.png&quot; width=&quot;100px&quot; height=&quot;100px&quot; style=&quot;border:1px solid #333333;&quot;&gt; &lt;?php endif; ?&gt; &lt;/td&gt;--&gt; &lt;td&gt;&lt;a href=&quot;delete.php?id=&lt;?php echo $row[&#039;transaction_id&#039;]; ?&gt;&amp;invoice=&lt;?php echo $_GET[&#039;invoice&#039;]; ?&gt;&amp;dle=&lt;?php echo $_GET[&#039;id&#039;]; ?&gt;&amp;qty=&lt;?php echo $row[&#039;qty&#039;];?&gt;&amp;code=&lt;?php echo $row[&#039;product&#039;];?&gt;&quot;&gt; Delete&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;?php } ?&gt; &lt;tr&gt; &lt;td colspan=&quot;9&quot;&gt;&lt;strong style=&quot;font-size: 12px; color: #222222;&quot;&gt;Total:&lt;/strong&gt;&lt;/td&gt; &lt;td colspan=&quot;3&quot;&gt;&lt;strong style=&quot;font-size: 12px; color: #222222;&quot;&gt; &lt;?php function formatMoney($number, $fractional=false) { if ($fractional) { $number = sprintf(&#039;%.2f&#039;, $number); } while (true) { $replaced = preg_replace(&#039;/(-?\d+)(\d\d\d)/&#039;, &#039;$1,$2&#039;, $number); if ($replaced != $number) { $number = $replaced; } else { break; } } return $number; } $sdsd=$_GET[&#039;invoice&#039;]; $resultas = $db-&gt;prepare(&quot;SELECT sum(total_amount) FROM sales_order WHERE invoice= :a&quot;); $resultas-&gt;bindParam(&#039;:a&#039;, $sdsd); $resultas-&gt;execute(); for($i=0; $rowas = $resultas-&gt;fetch(); $i++){ $fgfg=$rowas[&#039;sum(total_amount)&#039;]; echo formatMoney($fgfg, true); } ?&gt; &lt;/strong&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt;&lt;br&gt; &lt;strong&gt; &lt;input type=&quot;checkbox&quot; id=&quot;check&quot; /&gt; NOTE: Please be informed that the minimum purchase is ₱1000 worth of products. If not, your order will be void. &lt;br&gt;&lt;br&gt; &lt;a rel=&quot;facebox&quot; id=&quot;submit1&quot; style = &quot;background-color:green;&quot;class = &quot;btn btn-primary&quot; href=&quot;checkout.php?pt=&lt;?php echo $_GET[&#039;id&#039;]?&gt;&amp;invoice=&lt;?php echo $_GET[&#039;invoice&#039;]?&gt;&amp;total=&lt;?php echo $fgfg ?&gt;&amp;cashier=&lt;?php echo $session_cashier_name?&gt;&amp;p_amount=&lt;?php echo $ccc?&gt;&quot; disabled&gt;Check Out&lt;/a&gt; &lt;div class=&quot;clearfix&quot;&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;&lt;br&gt;&lt;br&gt; &lt;!-- /#page-wrapper --&gt; &lt;script&gt; $(&#039;#check&#039;).click(function() { if ($(this).is(&#039;:checked&#039;)) { $(&#039;#submit1&#039;).removeAttr(&#039;disabled&#039;); } else { $(&#039;#submit1&#039;).attr(&#039;disabled&#039;, &#039;disabled&#039;); } }); &lt;/script&gt; &lt;!-- jQuery --&gt; &lt;script src=&quot;vendor/jquery/jquery.min.js&quot;&gt;&lt;/script&gt; &lt;!-- Bootstrap Core JavaScript --&gt; &lt;script src=&quot;vendor/bootstrap/js/bootstrap.min.js&quot;&gt;&lt;/script&gt; &lt;!-- Metis Menu Plugin JavaScript --&gt; &lt;script src=&quot;vendor/metisMenu/metisMenu.min.js&quot;&gt;&lt;/script&gt; &lt;!-- Custom Theme JavaScript --&gt; &lt;script src=&quot;dist/js/sb-admin-2.js&quot;&gt;&lt;/script&gt; &lt;link href=&quot;vendor/chosen.min.css&quot; rel=&quot;stylesheet&quot; media=&quot;screen&quot;&gt; &lt;script src=&quot;vendor/chosen.jquery.min.js&quot;&gt;&lt;/script&gt; &lt;script&gt; $(function() { $(&quot;.chzn-select&quot;).chosen(); }); &lt;/script&gt; &lt;/body&gt;&lt;?php include(&#039;includes/footer.php&#039;);?&gt; &lt;/html&gt; **then this is the error page** &lt;?php session_start(); include(&#039;connect.php&#039;); $a = $_POST[&#039;invoice&#039;]; $b = $_POST[&#039;product&#039;]; $c = $_POST[&#039;qty&#039;]; $w = $_POST[&#039;pt&#039;]; $r = $_POST[&#039;vat&#039;]; $date = date(&#039;m/d/Y&#039;); $month = date(&#039;F&#039;); $year = date(&#039;Y&#039;); $discount = $_POST[&#039;discount&#039;]; $result = $db-&gt;prepare(&quot;SELECT * FROM products WHERE product_code= :userid&quot;); $result-&gt;bindParam(&#039;:userid&#039;, $b); $result-&gt;execute(); for($i=0; $row = $result-&gt;fetch(); $i++){ $asasa=$row[&#039;price&#039;]; $name=$row[&#039;product_name&#039;]; $dname=$row[&#039;description_name&#039;]; $categ=$row[&#039;category&#039;]; $qtyleft=$row[&#039;qty_left&#039;]; } //edit qty $sql = &quot;UPDATE products SET qty_left=qty_left-? WHERE product_code=?&quot;; $q = $db-&gt;prepare($sql); $q-&gt;execute(array($c,$b)); $fffffff=$asasa-$discount; $d=$fffffff*$c; $z=$qtyleft-$c; $vat=$d*$r; $total=$vat+$d; // query $sql = &quot;INSERT INTO sales_order (invoice,product,qty,amount,name,price,discount,category,date,omonth,oyear,qtyleft,dname,vat,total_amount) VALUES (:a,:b,:c,:d,:e,:f,:g,:h,:i,:j,:k,:l,:m,:n,:o)&quot;; $q = $db-&gt;prepare($sql); $q-&gt;execute(array(&#039;:a&#039;=&gt;$a,&#039;:b&#039;=&gt;$b,&#039;:c&#039;=&gt;$c,&#039;:d&#039;=&gt;$d,&#039;:e&#039;=&gt;$name,&#039;:f&#039;=&gt;$asasa,&#039;:g&#039;=&gt;$discount,&#039;:h&#039;=&gt;$categ,&#039;:i&#039;=&gt;$date,&#039;:j&#039;=&gt;$month,&#039;:k&#039;=&gt;$year,&#039;:l&#039;=&gt;$z,&#039;:m&#039;=&gt;$dname,&#039;:n&#039;=&gt;$vat,&#039;:o&#039;=&gt;$total)); header(&quot;location: sales.php?id=$w&amp;invoice=$a&quot;); ?&gt;
28
0
1
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft