Aqui está todo o meu código.
checkout.php
<? php session start ();
requer uma vez (“../ dataAccessLayer / dalSession.php”);
requer uma vez (“../ dataAccessLayer / dalProduct.php”);
requer uma vez (“../ dataAccessLayer / dalService.php”);
?>
<? php include (“../ header2.php”);?>
<br>
<div class = “w3-content” style = “max-width: 1400px; margin-top: 40px;”>
<! – The Grid ->
<div class = “w3-row-padding”>
<div class = “w3-container w3-card-2 w3-white w3-margin-bottom”>
<br>
<div class = “container”>
<h1>Shopping Cart</h1><hr>
<table class="table table-striped table-hover table-bordered">
<tbody>
<tr>
<th>Product</th>
<th>Price</th>
<th>Vat</th>
<th>Discount</th>
<th>Quantity</th>
<th>Total Price</th>
<th>Delete</th>
</tr>
<?php
if(isset($_POST['sub']))
{
for($i=0; $i<count($_SESSION['cart']); $i++)
{
//print "for loop in";
if(isset($_POST['qty_' . $_SESSION['cart'][$i]]))
{
//print $_POST['qty_' . $_SESSION['cart'][$i]];
$_SESSION['qty'][$i] = $_POST['qty_'.$_SESSION['cart'][$i]];
}
}
}
$total = 0;
//$_SESSION['cart']=[];
//if(isset($_POST['sub'])){
for($i=0; $i<count($_SESSION['cart']); $i++) //line 57
{
$p = new Product();
$p->product_id = $_SESSION['cart'][$i];
$r = $p->SelectById();
print "<tr>";
imprimir “<td align = ” center “”> </td>””;
echo “”<td align = “” center “”> $ r [2]””