I have a shopping cart script, which can calcalate the total and subtotal price, no problem,
now, I want to delete one or more items, but it doesn't work, I wish someone can help me, please!
delete.php
Code: Select all
<?php
session_start();
if(isset($_SESSION['name'])) unset($_SESSION['name']);
header('location: view_cart.php');
?>Code: Select all
<?php
$totalprice=0;
foreach($listproduit as $produit) {
$subtotal=$produit['quantity']*$produit['price'];
$totalprice+=$subtotal;
?>
<tr>
<td><?php print $produit['name'] ?></td>
<td><?php print $produit['price'] ?></td>
<td><?php print $produit['quantity'] ?></td>
<td><?php print($produit['quantity']*$produit['price'])?>€</td>
<td> <a href="delete.php?name=<?php print $produit['name'] ?>">delete</a></td>
</tr>
<?php } ?>
<?php echo "Total: $totalprice";?>€