Home>Article>Backend Development> Code 1 about implementing shopping cart in php

Code 1 about implementing shopping cart in php

不言
不言 Original
2018-06-19 17:21:08 2385browse

This article introduces a shopping cart code implemented in PHP. The function implementation is relatively complete. It implements functions such as shopping cart, orderer information, membership price, etc. It is still good. Friends in need can refer to it

1. Product display page

【市场价:
【会员价:
查看信息
放入购物车
【剩余数量: 0) { echo ($info[shuliang]-$info[cishu]); } else { echo "已售完"; } ?>】

2. File addgouwuche.php

alert('请先登录后购物!');history.back();"; exit; } $id=strval($_GET[id]); $sql=mysql_query("select * from shangpin where id='".$id."'",$conn); $info=mysql_fetch_array($sql); if($info[shuliang]<=0) { echo ""; exit; } $array=explode("@",$_SESSION[producelist]); for($i=0;$ialert('该商品已经在您的购物车中!');history.back();"; exit; } } $_SESSION[producelist]=$_SESSION[producelist].$id."@"; $_SESSION[quatity]=$_SESSION[quatity]."1@"; header("location:gouwu1.php"); ?>

3. File gouwu1.php

alert('请先登录,后购物!');history.back();"; exit; } ?>  

的购物车

"; echo" "; echo""; } else { ?>
您的购物车为空!

商品名称

数量

市场价

会员价

折扣

小计

操作

>

移除

去收银台

清空购物车

总计:

3. File gouwu2.php

收货人信息

收货人姓名:

性别:

详细地址:

邮政编码:

联系电话:

电子邮箱:

送货方式:

支付方式:

简单留言:

"; echo" window.open('showdd.php?dd='+'".$dd."','newframe','top=150,left=200,width=600,height=".$sum.",menubar=no,toolbar=no,location=no,scrollbars=no,status=no ')"; echo ""; } ?>

4, database configuration file conn.php

The above is the entire content of this article. I hope it will be helpful to everyone's study. For more related content, please pay attention to the PHP Chinese website !

Related recommendations:

Use PHP to implement the payment function of Alipay on the mobile APP

How to use PHP to implement quick money payment Function

The above is the detailed content of Code 1 about implementing shopping cart in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn