Hey, i'm trying to code a shopping cart and need to enable a feature for the user to delete items from their shopping cart.
This is the essence of my cart.php:
if (isset($add)) {
$products_array[] = $add;
}
print "<br>";
foreach ($products_array as $id) {
$result = mysql_query("select * from products where id = $id");
while ($array = @mysql_fetch_array($result, MYSQL_ASSOC)) {
print "<b><u>".$array[name]."</u></b> | ";
print "<i>$".$array[price]."</i><br>";
print $array[description]."<br><br>";
}
}
print "<a href='productindex.php?PHPSESSID=".$sessid."'>Keep Shopping</a>";
Previously I tried something like this:
if (isset($delete)) {
foreach($products_array as $i) {
if ($i == $delete) {
$i = NULL;
}
}
}
What should I do? Thanks!