I have a shopping cart form and need help with the 'recalculate order' button. The form submits the followig things: productid, cartid and quantity.
On the form the user can change the quantity field for anyone of the products listed in the cart.
The 'recalculate order' button updates the whole cart and not just one item.
This is what I need:
cartid: static (works fine!)
productid: could be more than 1 so need to insert into an array.
quantity: could be more than 1 so need to insert into an array.
so I need the following info returned:
productid | quantity
12 3
23 5
65 1
and use this in a query like this:
foreach($id as $val)
{
$sql = " UPDATE cart SET
quantity='$uqty'
WHERE cartid = '$cartid' && productid = '$val'";
mysql_query($sql) or die("Cannot update the database.<br>" . mysql_error());
}
the problem with the current query is it doesn't use an array for the 'quantity'. and will update all fields according to the last entered quantity.
Any help would be great!! :-)
-Dizzy