$value) {
if (stristr($key,'qty')) {
$book_id = str_replace('qty','',$key);
$items = ($newcart != '') ? explode(',',$newcart) : explode(',',$cart);
$newcart = '';
foreach ($items as $item) {
if ($book_id != $item) {
if ($newcart != '') {
$newcart .= ','.$item;
} else {
$newcart = $item;
}
}
}
for ($i=1;$i<=$value;$i++) {
if ($newcart != '') {
$newcart .= ','.$book_id;
} else {
$newcart = $book_id;
}
}
}
}
}
$cart = $newcart;
break;
}
$_SESSION['cart'] = $cart;
PHP Shopping Cart Demo · Cart


