PHP 更新购物车数量
2013-04-28 23:05
344 查看
表单部分:
PHP 处理部分:
<form action="?action=edit_num" method="post" name="car<?php $c_rs['id'];?>" id="car<?php $c_rs['id'];?>"> <input name="suliang[<?php echo $c_rs['sp_id'];?>]" type="text" id="suliang[<?php echo $c_rs['sp_id'];?>]" value="<?php echo $c_rs['suliang'];?>"/> <input type="submit" name="button" id="button" value="更新购物车" /> </form>
PHP 处理部分:
<?php require 'config.inc.php'; require 'checklogin.php'; $username = $_SESSION['username']; $action = $_GET['action']; switch ($action) { case "edit_num": $arr = $arr = $_POST['suliang']; foreach($arr as $key=>$value){ $sqlgx = "update `cartemp` set suliang='$value' where username='".$username."' and flag=0 and sp_id='".$key."'"; mysql_query($sqlgx, $conn); echo "<script>location.href='shopcat.php'</script>"; } break; case "null": $null_sql = "delete from `cartemp` where username='$username' and flag=0 "; mysql_query($null_sql, $conn); echo "<script>location.href='shopcat.php'</script>"; break; case "del": $id = $_GET['id']; $del_sql = "delete from `cartemp` where id=$id"; mysql_query($del_sql, $conn); echo "<script>location.href='shopcat.php'</script>"; break; } ?>
相关文章推荐
- PHP 更新购物车数量
- PHP更新购物车数量(表单部分/PHP处理部分)
- PHP更新购物车数量(表单部分/PHP处理部分)
- magento -- 推荐插件 --Ajax更新购物车数量 --Ajax Shopping Cart Quantity Update
- ajax更新购物车数量
- ecshop购物车页面使用ajax更新商品数量、小计、总价,点击加号和减号
- magento 产品详细页面添加购物车数量实时更新总价格
- php AJAX 购物车 点击添加到购物车ajax返回添加到购物车同时返回购物车当前产品数量
- php AJAX 购物车 点击添加到购物车ajax返回添加到购物车同时返回购物车当前产品数量
- ecshop修改商品数量后自动更新购物车
- ECSHOP商品购买数量增加加减按钮插件(包含购物车商品数量增加减少,自动更新)
- magento购物车添加减少数量 实时更新购物车
- ECSHOP系统ajax更新购物车数量
- php基于thinkphp的购物车--能够更改商品数量
- magento更新购物车产品数量
- ECSHOP利用ajax更新购物车数量
- ajax更新购物车数量
- php网上商城购物车设计代码分享
- DolrPHP框架 更新帖
- php程序员之面试宝典(不断更新)