I am deleting an item from a shopping cart by using:
in conjunction with:
which works BUT it only deletes if you click on the remove image file TWICE.
Is there a way to get this to work on the first click?
Thanks.
Code:
<a href="ShoppingBag.php?removeitem=<?php echo $row["cartId"]; ?>"><img src="Del.jpg"></a>
in conjunction with:
Code:
if (!empty($_GET['removeitem'])) {
RemoveItem($_GET['removeitem']);
}
function RemoveItem($cartId)
{
global $dbServer, $dbUser, $dbPass, $dbName;
// Get a connection to the database
$cxn = @ConnectToDb($dbServer, $dbUser, $dbPass, $dbName) or die(mysql_error());
mysql_query("delete from cart where cookieId = '" . GetCartId() . "' and cartId = $cartId") or die(mysql_error());
}
which works BUT it only deletes if you click on the remove image file TWICE.
Is there a way to get this to work on the first click?
Thanks.