【php开源代码栏目提醒】:网学会员在php开源代码频道为大家收集整理了addtocart.php提供大家参考,希望对大家有所帮助!
<?php
//加入购物车Class的声明
require_once('cart/EDcart.php');
session_start();
$cart =& $_SESSION['edCart'];
if(!is_object($cart)) $cart = new edCart();
?>
<?
//执行购物车操作
$DoSomeThing = (isset($_GET['A']) ? $_GET['A'] : "");
switch($DoSomeThing){
case "Add":
$cart->add_item($_GET['prono'],1,$_GET['price'],$_GET['name'],isset($_GET['pic'])?$_GET['pic']:'');
break;
case "Remove":
$cart->del_item($_GET['prono']);
break;
case "Empty":
$cart->empty_cart();
break;
case "Update":
for($startNO=0;$startNO < $_GET['itemcount'];$startNO++){
$cart->edit_item($_GET['itemid'][$startNO],$_GET['qty'][$startNO]);
}
break;
}
?>
<?php header("Location:cartBasket.php");?>
<!DOCTYPE html PUBLIC "-//W3C//DTD X
HTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题
文档</title>
</head>
<body>
</body>
</html>