- 1、本文档共10页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
通过session实现购物车功能
PHP基础教程(118) 通过session实现购物车功能(1)
时间:2010-01-23来源:PHP教程网 作者:PHP教程网 点击: 437次
conn.php: 数据库连接页 ?php $id=mysql_connect(localhost,root,mysql); //数据库的帐号密码请修改mysql_select_db(db_database05,$id);mysql_query(set names gb2312);? index.php: htmlheadmeta http-equiv=Content-Type content=text/html; charse
conn.php:? 数据库连接页
?php
$id=mysql_connect(localhost,root,mysql); //数据库的帐号密码请修改
mysql_select_db(db_database05,$id);
mysql_query(set names gb2312);
?
index.php:?
html
head
meta http-equiv=Content-Type content=text/html; charset=gb2312
title通过session实现购物车功能/title
style type=text/css
!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
--
/style
/head
body
table width=392 height=249 border=0 cellpadding=0 cellspacing=0
form name=form1 method=post action=index_ok.php
tr
td height=100 colspan=3nbsp; /td
/tr
tr
td width=157 height=51nbsp;/td
td width=138input name=user type=text id=user3 size=15/td
td width=97
input name=imageField type=image src=images/139s.jpg width=50 height=25 border=0
/td
/tr
tr
td height=30nbsp;/td
tdinput name=pass type=password id=pass2 size=15/td
tdinput name=imageField2 type=image src=images/139ss.jpg width=50 height=25 border=0
/td
/tr
tr
tdnbsp;/td
tdnbsp;/td
tdnbsp;/td
/tr
/form
/table
/body
/html
index_ok.php:?
?php session_start();
$user=$_POST[user];
$pass=$_POST[pass];
if($user!= $pass!=){ //判断该用户和密码是否正确
echo 登录成功!;
//session_register(user); //注册新的session变量
//session_register(pass);
$_SESSION[user] = $user;
$_SESSION[pass] = $pass;
// session_register(producelist); //发给用户一个购物车
$_SESSION[producelist];
$producelist=;
//session_register(quatity); //初始化购物车内没有商品
$_SESSION[quatity];
$quatity=;
echo meta http-equiv=\refresh\ content=\3;url=shop.php\3秒钟转入主页,请稍等......;
}else{
echo scriptalert(登录失败!);history.back();/script; ;
}
?
PHP基础教程(119) 通过session实现购物车功能(2)
时间:2010-01-23
您可能关注的文档
- Djnet音色 Djent Tone.doc
- 浅谈中国八大菜系的形成因素.docx
- 蛋白质分析相关数据库及网站.docx
- 钢琴艺术史试卷.doc
- Windows+中不规则窗体的编程实现.doc
- my代码跟踪之driver_register.doc
- servlet注册程序实例.docx
- 责任、荣誉和国家.doc
- Chassis_001__底盘(翻译及原文).doc
- 中规院50周年院庆学术讲座.doc
- 新高考生物二轮复习讲练测第6讲 遗传的分子基础(检测) (原卷版).docx
- 新高考生物二轮复习讲练测第12讲 生物与环境(检测)(原卷版).docx
- 新高考生物二轮复习讲练测第3讲 酶和ATP(检测)(原卷版).docx
- 新高考生物二轮复习讲练测第9讲 神经调节与体液调节(检测)(原卷版).docx
- 新高考生物二轮复习讲练测第11讲 植物生命活动的调节(讲练)(原卷版).docx
- 新高考生物二轮复习讲练测第8讲 生物的变异、育种与进化(检测)(原卷版).docx
- 新高考生物二轮复习讲练测第5讲 细胞的分裂、分化、衰老和死亡(讲练)(原卷版).docx
- 新高考生物二轮复习讲练测第5讲 细胞的分裂、分化、衰老和死亡(检测)(原卷版).docx
- 新高考生物二轮复习讲练测第12讲 生物与环境(讲练)(原卷版).docx
- 新高考生物二轮复习讲练测第11讲 植物生命活动的调节(检测)(原卷版).docx
文档评论(0)