I am building a shopping basket with various products options. I have created my form with a get action:
<form method="get" action="">
<input name="category" type="hidden" value="<?php echo $category; ?>">
<input name="product_option_id" type="hidden" value="<?php echo $showProductOptions['id']; ?>">
<input type="text" maxlength="3" size="2" value="1" class="formqty" id="quantity_wanted" name="qty">
">
When this is sent the URL looks like this:
menu.php?category=fruit-and-dessert&product_option_id=13&qty=1&product_option_id=14&qty=2&formadd=
What I need help with is to add the product option id and the quantity into a mySQL table. I have created this script but it doesn't add into the database? I don't get any error message either?
if(isset($_GET['formadd'])) {
foreach ($_GET as $productoptionid => $quantity) {
if(is_numeric($productoptionid) && is_numeric($quantity)) {
mysql_query(" INSERT INTO standard_basket SET session_id = '".$sessionid."', product_option_id = '".$productoptionid."', quantity = '".$quantity."'") or die(mysql_error());
}
}
}
Can anyone help? Many thanks!