PHP or Javascript
Posted: Sat Dec 11, 2004 7:00 pm
Hello all, I'm not sure if this problem is being caused by PHP or Javascript, but...
I've got a PHP page that I am using to remove a product from the cart. I am passing an ID on the URL TO this page and retrieving with $_GET to identify the product to be axed.
This script simply deletes it from the database. I am then using a Javascript function (triggered by body onload) to return the use back the page they came from.
No problem, except, when the Javascript redirects the page, it's adding "?id=xxx" to the url, which I don't want it to do.
Any ideas? I've tried unset($id) but that didn't work.
Thanks in advance,
Philip
I've got a PHP page that I am using to remove a product from the cart. I am passing an ID on the URL TO this page and retrieving with $_GET to identify the product to be axed.
This script simply deletes it from the database. I am then using a Javascript function (triggered by body onload) to return the use back the page they came from.
No problem, except, when the Javascript redirects the page, it's adding "?id=xxx" to the url, which I don't want it to do.
Any ideas? I've tried unset($id) but that didn't work.
Code: Select all
<?
//START SESSION
session_start();
header("Cache-control: private");
$id = $_GETї'id'];
//CONNECT TO DB
//DELETE THE PRODUCT
$sql = "delete from cart_contents where id="$id";
","$quantity","$color","$size")";
#execute the sql
$exc = mysql_query("$sql");
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
function removed()
{
window.location.pathname = "/cart_quantity_input.php";
}
</script>
</head>
<body onLoad="removed()">
</body>
</html>Philip