Hi,
I've created a shopping cart by using a MySQL table record. The user can change/delete an item in the cart by altering its quantity from a dropdown box. This re-loads the page (via Javascript onChange even trigger) passing the variables $update (the item number in the cart list starting from zero) and $value (the new quantity value required). Upon page reload the following code is triggered:
if ($update){
$shopping_basket_quantity_array[$update] = $value;
$new_quantity = implode("|", $shopping_basket_quantity_array);
$sql = "UPDATE shopping_cart SET quantity = '$new_quantity' WHERE webuser = '$webuser'";
$result = mysql_query($sql, $db);
}
This works fine and dandy for any array item higher than zero. However if the array element is sero (first in the list), no action takes place? For example, selecting the first item in the cart does not work. However, selecting item one or above in the listing causes the value of that array element to be updated by my code above. Why?
I'm probably being really dumb (again :0 ) somewhere.
kind regards,
Graham Nichols.