Hi
I have a shopping basket that needs to allow a user to 'remove' an item from their basket. The basket is a session variable:
$_SESSION['basket'][$_POST['product']}PHP]
and when echoed it looks like this:
[code=php]Array
(
[8] => Array
(
[quantity] => 2
[productprice] => 400.00
)
[6] => Array
(
[quantity] => 1
[productprice] => 200.00
)
[7] => Array
(
[quantity] => 1
[productprice] => 300.00
)
)
How can I remove the (lets say ID number 7 item) from the array above? On my page I have a checkbox for each item called'removeitem[]' and a value of the $productid. I have this code so far to help remove an item but am i on the wrong lines?
if (isset($_POST['removeitem'])) {
$deleteitems = $_POST['removeitem']; // array of all id's ready to be deleted
foreach($deleteitems as $delid) {
unset(???);
}
}
Can anyone help me out with deleting only part of the array if the checkbox is checked?
Thanks