Forum Moderators: coopster
<td><input type="text" id="quantity" name="quantity-<?php echo $_POST['quantity'];?><?php echo $row['id_products'];?>" size="5" value="<?php echo $_SESSION['cart'][$row['id_products']]['quantity'];?>"></td>
<td><?php echo "$" . $row['price'];?></td>
<td><?php echo "$" . $_SESSION['cart'][$row['id_products']]['quantity']*$row['price'];?></td>
</tr>
<?php
if (isset($_POST['submit'])){
foreach($_POST as $key){
$key = explode("-",$key);
$key = end($key);
$key = explode("submit", $key);
$key = end($key);
if($_POST['quantity-'.$key] == 0){
unset($_SESSION['cart'] [$key]);
//echo "Unset session";
}else{
$_SESSION['cart'][$key]['quantity'] = $value;
//echo "Updated session";
}
}
}