日期:2014-05-17  浏览次数:20871 次

购物车问题,来者得分!
我做了一个购物系统,就在购物车那里出了点问题:我现在做的是没有购物都可以进入结帐中心,我是想改为,购物车空的时候就不能进入结帐中心.我现在给出结帐中心的一些主要的代码,大家看看怎么去判断?

<%
openconn1()
dim   idArray(100),numArray(100)
if   request.ServerVariables( "REQUEST_METHOD ")= "POST "   then  
'request.form( "submit ")= "确定购物 "   then
for   i=1   to   ubound(split(session( "ProductList "), ",   ",-1,1))
idArray(i)=trim(request.form( "id "&i))
numArray(i)=trim(request.form( "num "&i))
'response.write   "产品名: "&getpartname(idArray(i))& " 产品数量: "&numArray(i)& " <br> "
next
elseif   request.form( "submit ")= "提交订单 "   then
orderno=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)
C_name=Trim(Request.Form( "C_name "))
type1=Trim(Request.Form( "type "))
postno=Trim(Request.Form( "postno "))
address=Trim(Request.Form( "add "))
tel=Trim(Request.Form( "tel "))
mobile=Trim(Request.Form( "mobile "))
email=Trim(Request.Form( "email "))
sn=Trim(Request.Form( "sn "))
remark=Trim(Request.Form( "remark "))

if   c_name= " "   or   postno= " "   or   address= " "   or   mobile= " "   then   response.end  
for   i=1   to   ubound(split(session( "ProductList "), ",   ",-1,1))
idArray(i)=trim(request.form( "id "&i))
numArray(i)=trim(request.form( "num "&i))
sum=trim(request.Form( "sum "))
'response.write   "产品名: "&getpartname(idArray(i))& " 产品数量: "&numArray(i)& " <br> "
sql= "insert   into   [order](orderno,proname,retailprice,num,allprice)   values( ' "&orderno& " ', ' "&getpartname(idArray(i))& " ', ' "&getprize(idArray(i))& " ', ' "&numArray(i)& " ', ' "&sum& " ') "
'response.Write   sql
conn1.execute   sql
next
sql= "insert   into   orderdetail(orderno,c_name,type,postno,address,tel,mobile,email,remark   )   values( ' "&orderno& " ', ' "&c_name& " ', ' "&type1& " ', ' "&postno& " ', ' "&address& " ', ' "&tel& " ', ' "&mobile& " ', ' "&email& " ',   ' "&sn& " ', ' "&remark& " ') "

conn1.execute   sql
response.write   " <script   lanuage=javascript> alert( '提交订单成功,你的订单号为:   "&orderno& " ') </script> "
end   if


function   getpartname(id)
sql= "select   id,proname   from   products   where   id= ' "&id& " ' "
call   getrsbysql(conn1,rs1,sql,1,1,0)
if   rs1.bof   and   rs1.eof   then
getpartname= "暂无 "
else
getpartname=rs1(1)
end   if
end   function
function   getprize(id)
sql= "select   id,RetailPrice   from   products   where   id= ' "&id&am