rollerboy Posted June 22, 2006 Share Posted June 22, 2006 Hi I have a shopping cart that displays the products that a customer buys. When a customer buys a product only one is added to the cart. I would like a way of updateing the quantity in the cart. The code for the cart is below. I would be grateful for any suggestions?ps I'm new to php.<?phpinclude ("Products_inc.php");//call to stylesheet on include fileHeaderAndStylesheet();$query= "SELECT*FROM cart WHERE Username='$Username'";$result=mysql_query($query);$num=mysql_num_rows($result);if ($num ==0){echo "The database contains no contacts yet";}else{echo "<b><centre> Cart</centre></b><br><br>";//echo "$Full_name";?><table border ="1" cell spaceing= "2" cellpadding= "2"><tr><th><font face= "Arial, Helvetica, sans-serif"> order id</font></th><th><font face= "Arial, Helvetica, sans-serif"> Product Name</font></th><th><font face= "Arial, Helvetica, sans-serif"> Username</font></th><th><font face= "Arial, Helvetica, sans-serif"> Product Description</font></th><th><font face= "Arial, Helvetica, sans-serif"> Price</font></th><th><font face= "Arial, Helvetica, sans-serif"> Quantity</font></th><th><font face= "Arial, Helvetica, sans-serif"> Delete</font></th></tr><?$i=0;while ($i<$num){$order_id=mysql_result($result, $i, "order_id");$Name=mysql_result($result, $i, "Name");$Username=mysql_result($result, $i, "Username");$Description=mysql_result($result, $i, "Description");$Price=mysql_result($result, $i, "Price");$Quantity=mysql_result($result, $i, "Quantity");?><tr><td width=100><font face="Arial,Helvetica, sans-serif"><? echo $order_id?></font></td><td width=100><font face="Arial,Helvetica, sans-serif"><? echo $Name?></font></td><td width=100><font face="Arial,Helvetica, sans-serif"><? echo $Username?></font></td><td width=150><font face="Arial,Helvetica, sans-serif"><? echo $Description?></font></td><td width=100><font face="Arial,Helvetica, sans-serif"><? echo "£$Price"?></font></td><td><font face="Arial,Helvetica, sans-serif"><? echo $Quantity?></font></td><td><font face="Arial,Helvetica, sans-serif"><?echo "<form action=\"delete_from_cart.php\" method=\"post\">";echo "<input type=\"submit\" value=\"Delete\">";echo "<input type=\"hidden\" name =\"order_id\" value=$order_id>";echo "<input type=\"hidden\" name =\"Username\" value=$Username>";echo "</form>";?></td></tr><?$i++;}echo "</table>";}echo "<form action=\"display_product.php\" method=\"post\">";echo "<input type=\"submit\" value=\"Continue shopping\">";echo "<input type=\"hidden\" name =\"Username\" value=$Username>";echo "<input type=\"hidden\" name =\"Full_name\" value=$Full_name>";echo "</form><br>";echo "<form action=\"check_out.php\" method=\"post\">";echo "<input type=\"submit\" value=\"Go to check out\">";echo "<input type=\"hidden\" name =\"Username\" value=$Username>";echo "<input type=\"hidden\" name =\"Full_name\" value=$Full_name>";echo "</form>";?> Link to comment https://forums.phpfreaks.com/topic/12680-update-help/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.