Hello all!
Kinda new to PHP and I'm stuck on a small problem. I am trying to creat a shopping cart, and so far everything is working, except for updating multiple quantities at one time. For example...you add 4 different items to the shopping cart, but you decide you want to change the quantities! Well, I have added an INPUT field to update each of these quantities, but I want all the quantities to be updated when you click on a small UPDATE CART button at the bottom of the entire cart.
Here is the code to VIEW the things on the cart:
<?php
@$num = mysql_num_rows($result);
$total = 0.00;
if ($num > 0)
{
while ($row = mysql_fetch_array($result))
{
extract ($row);
$total = $total + ($cartQty * $productPrice);
echo "
<TR>\n
<TD HEIGHT='20' BGCOLOR='#FFFFFF'><INPUT TYPE='Text' SIZE='3' VALUE='$cartQty' NAME='newCartQty'></TD>\n
<TD HEIGHT='20' BGCOLOR='#FFFFFF'><FONT CLASS='bodyCopy'> $productCode</FONT></TD>\n
<TD HEIGHT='20' BGCOLOR='#FFFFFF'><FONT CLASS='bodyCopy'> $productName</FONT></TD>\n
<TD HEIGHT='20' BGCOLOR='#FFFFFF' ALIGN='Right'><FONT CLASS='bodyCopyIndentR'>$productPrice</FONT></TD>\n
</TR>";
}
}
?>
When you click submit on this form, this page passes the variables with GET to a script called updateCart.php. This is the script I have no clue how to code.
The above code pulls all its information from a MySQL table that looks like this:
cartID (primary Key) <----random cookie number
productID (primary Key) <----unique id for each product
cartQty <--- current quantity
dateAdded <--- the date the product was added to the cart
ANY help will be greatly appreciated!!!
Thank you,
dm