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

一个购物车的传值问题
各位:
        本人在赶个手机网站(asp),含购物车,手机表中定有“定价(price1)”,“会员价(price2)”,还有该型号手机的不同的颜色价:ColorPri1,ColorPri2...ColorPri6,等字段,除了购买手机之外,还可以购买手机配件,手机配件含“定价(price1)”,“会员价(price2)”。手机与配件同表。现问题是会员登陆后选中某款手机后,如若用户想买该款的其他颜色机,此时就要传该颜色价(若ColorPri1),点“购买”后,可以传该值到购物车首页,该页中传值为此   :
      ColorPri=trim(request.Form( "ColorPri "))
      session( "ColorPri ")=ColorPri       ----取颜色价
      ........
      if   session( "ColorPri ")=trim(rsCheck( "ColorPri1 "))   then                     '赋给不同价
strprice2   =   trim(rsCheck( "ColorPri1 "))
elseif   session( "ColorPri ")=trim(rsCheck( "ColorPri2 "))   then  
strprice2   =   trim(rsCheck( "ColorPri2 "))
elseif   session( "ColorPri ")=trim(rsCheck( "ColorPri3 "))   then  
strprice2   =   trim(rsCheck( "ColorPri3 "))
elseif   session( "ColorPri ")=trim(rsCheck( "ColorPri4 "))   then  
strprice2   =   trim(rsCheck( "ColorPri4 "))
elseif   session( "ColorPri ")=trim(rsCheck( "ColorPri5 "))   then  
strprice2   =   trim(rsCheck( "ColorPri5 "))
elseif   session( "ColorPri ")=trim(rsCheck( "ColorPri6 "))   then  
strprice2   =   trim(rsCheck( "ColorPri6 "))
elseif   session( "customer ") <> " "   then  
strprice2   =   Round(rsCheck( "Price2 "),2)
elseif   session( "customer ")= " "   then  
strprice2   =   Round(rsCheck( "Price1 "),2)
end   if  
'---------strpric2为购物车页面的定价字段,Price2为会员价,Price1为定价,Session( "customer ")记录会员名
第二步:再点击:到“收银台”
      该页面中获取不同价也加此   判断:
      if   session( "price ")=Round(rsCheck( "ColorPri1 "),2)   then                     '赋给不同价
strprice2   =   Round(rsCheck( "ColorPri1 "),2)
elseif   session( "price ")=trim(rsCheck( "ColorPri2 "))   then  
strprice2   =   trim(rsCheck( "ColorPri2 "))
elseif   session( "price ")=trim(rsCheck( "ColorPri3 "))   then  
strprice2   =   trim(rsCheck( "ColorPri3 "))
elseif   session( "price ")=trim(rsCheck( "ColorPri4 "))   then  
strprice2   =   trim(rsCheck( "ColorPri4 "))
elseif   session( "price ")=trim(rsCheck( "ColorPri5 "))   then  
strprice2   =   trim(rsCheck( "ColorPri5 "))
elseif   session( "price ")=trim(rsCheck( "ColorPri6 "))   then  
strprice2   =   trim(rsCheck( "ColorPri6 "))
elseif   session( "customer ") <> " "   then  
strprice2   =   Round(rsCheck( "Price2 "),2)
elseif   session( "customer ")= " "   then  
strprice2   =   Round(rsCheck( "Price1 "),2)
end   if  
此时该“收银台”页面读不了颜色价,显示为读取会员价。请问问题出在哪里,该怎么调整程序呢?

------解决方案--------------------
你首先应该用FOR循环的形式重新写一下上边的判断.否则代码看起来会吓到人