Possible Duplicate:
PHP: How to remove specific element from an array?
I've got an array for holding shopping basket information:
session_start();
$items = $_SESSION['items'];
$values = $_SESSION['values'];
if (isset($_POST['addtobasket']))
{
$items[] = $_POST['item'];
$values[] = $_POST['value'];
$_SESSION['items'] = $items;
$_SESSION['values'] = $values;
}
print("Added " . $_POST['item'] . " with value of " . $_POST['value'] . "to basket");
?>
At the checkout screen I'd like to be able the user to be able to remove items:
<?
echo "<table class='basketdisplay'>";
echo "<tr><td>Item</td><td>Price</td></tr>";
foreach($items as $key => $item)
{
echo "<tr>";
echo "<td>" . $item . "</td>";
echo "<td>£" . $values[$key] . "</td>";
echo "<td>" . $key . "</td>";
echo "</tr>";
}
echo "</table>";
?>
So instead of the last column showing the key, some form of button to remove the item at that key?
Does anyone know how I'd go about this, my php is not strong. TIA