t; To: [EMAIL PROTECTED]
> Subject: [PHP] Can't remove an element from an array
>
>
> Hi, I have an array that holds the item_id's for a shopping cart. I am
> trying to remove the item specified by a GET like this:
>
> foreach ($_SESSION["cart_array"] as $i
Brian Dunning wrote:
Hi, I have an array that holds the item_id's for a shopping cart. I am
trying to remove the item specified by a GET like this:
foreach ($_SESSION["cart_array"] as $item) {
if ($item==$_GET["item_id"]) {unset($_SESSION["cart_array"], $item);
break;}
}
But it removes ALL i
Hi, I have an array that holds the item_id's for a shopping cart. I am
trying to remove the item specified by a GET like this:
foreach ($_SESSION["cart_array"] as $item) {
if ($item==$_GET["item_id"]) {unset($_SESSION["cart_array"], $item);
break;}
}
But it removes ALL items from the cart. An
3 matches
Mail list logo