本文介绍一个php实现的购物车代码,功能实现比较完整,实现了购物车、订货人信息、会员价等功能,还是不错的,有需要的朋友,可以参考下
1、商品展示页面
@@##@@" width="130" height="100" border="0"> |
【】 | |
| 【市场价:】 | ||
| 【会员价:】 | ||
| 【查看信息】 | ||
| 【放入购物车】 | ||
| 【剩余数量: 0) { echo ($info[shuliang]-$info[cishu]); } else { echo "已售完"; } ?>】 |
2、文件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、文件gouwu1.php
alert('请先登录,后购物!');history.back();";
exit;
}
?>
|
3、文件gouwu2.php
立即学习“PHP免费学习笔记(深入)”;
|
|
4、数据库配置文件conn.php
以上就是本文的全部内容,希望对大家的学习有所帮助,更多相关内容请关注PHP中文网!
相关推荐:











