Hello I am trying to make a shopping cart script that works with paypal however I am stuck with this peice of code the deleting of items returns no errors and says it has deleted the item(s) selected and updating the quantity has so far not reported any errors or warnings but rather returns nothing
this is my code for updating the script
if (isset($HTTP_GET_VARS['updatecart'])){
// You have reached the update cart page
$item_range = range (0, 1000); // has to start at zero and 1000 can be changed depending on number of items
foreach($item_range as $item_num){
if ($_POST[$item_num."_del"] == "ON"){
$qty_item = $_POST[$item_num."_rqty"] ;
$new_items_list = str_replace("id=".$item_num."&qty=".$qty_item."|", "", $get_items);
setcookie("bl-cart", $new_items_list, 0);
echo "item deleted!";
}
if (($_POST[$item_num."_del"] != "ON") && (isset($_POST[$item_num."_qty"])) && (isset($_POST[$item_num."_rqty"]))){
$qty_item = $_POST[$item_num."_qty"] ;
$rqty_item = $_POST[$item_num."_rqty"];
$new_items_list = str_replace("id=".$item_num."&qty=".$rqty_item, "id=".$item_num."&qty=".$qty_item, $get_items);
setcookie("bl-cart", $new_items_list, 0);
echo "item updated!";
}
}
}
the value of delete in the form is set to on and the reason i have used such a messy foreach statement is because it is the only way i can think of to get the id number of my item
$item_id."qty" means that the value of that post is the items own unique number followed by qty e.g. 1_qty, 2_qty this is a unique number set by the catalogue not the cart
thanx in advance:evilgrin: