您现在的位置: 军旅同心 >> 读书赏析 >> 学习园地 >> 电脑网络 >> 技术文章 >> 文章正文
一个简单的网上书城的例子(四)
作者:采集员 文章来源:来源于网络 点击数: 更新时间:2005-9-10 14:06:15
check.asp:用户察看所购物品!

<!--#include file="Util.asp" -->

<%
Head="以下是您所选购的物品清单"

ProductList = Session("ProductList")
If Len(ProductList) = 0 Then Response.Redirect "Nothing.asp"

DbPath = SERVER.MapPath("ShopBag.mdb")
Set conn = Server.CreateObject("ADODB.Connection")
conn.open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DbPath

If Request("MySelf") = "Yes" Then
   ProductList = ""
   Products = Split(Request("ProductID"), ", ")
   For I=0 To UBound(Products)
      PutToShopBag Products(I), ProductList
   Next
   Session("ProductList") = ProductList
   Session("First")="no"
End If

sql = "Select * From Products"
sql = sql & " Where ProductID In (" & ProductList & ")"
sql = sql & " Order By ProductID"
Set rs = conn.Execute( sql )
%>

<HTML>
<HEAD><TITLE><%=Head%></TITLE></HEAD>
<BODY BACKGROUND="b01.jpg">
<H2 ALIGN=CENTER><%=Head%></H2>
<CENTER>
<Form Action=Check.asp Method=POST>
<Input Type=Hidden Name=MySelf Value=Yes>
<TABLE Border=1>
<TR BGCOLOR=#00FFFF>
<TD>取消</TD><TD>书刊编号</TD><TD>书刊名称</TD><TD>单价</TD><TD>数量</TD><TD>总价</TD><TD>商品简介</TD></TR>
<%
   Sum = 0
   C_ProductID=""
   C_Quatity=""
   While Not rs.EOF
    if Session("First")="yes" then
      Quatity=1
    else    
     Quatity = CInt( Request( "Q_" & rs("ProductID")) )
     If Quatity <= 0 Then
        Quatity = CInt( Session(rs("ProductID")) )
        If Quatity<=0 Then Quatity = 1
     End If
     end if
     Session(rs("ProductID")) = Quatity
     Sum = Sum + CDbl(rs("Price")) * Quatity
     
    If Len(C_ProductID) = 0 Then
       C_ProductID = "" & rs("ProductID") & ""
       C_ProductName = "" & rs("ProductName") & ""
       C_Quatity = "" & Quatity & ""
     Else
       C_ProductID =  C_ProductID & "/" & rs("ProductID") & ""
       C_ProductName =  C_ProductName & "/" & rs("ProductName") & ""
       C_Quatity = C_Quatity & "/" &  Quatity & ""
     End If     

     
%>
<TR>
<TD Align=Center>
<Input Type=CheckBox Name="ProductID" Value="<%=rs("ProductID")%>" Checked>
</TD>

<TD><%=rs("ProductID")%></TD>
<TD><%=rs("ProductName")%></TD>
<TD Align=Right><%=rs("Price")%></TD>
<TD><Input Type=Text Name="<%="Q_" & rs("ProductID")%>" Value=<%=Quatity%> Size=3></TD>
<TD Align=Right><%=CDbl(rs("Price"))*Quatity%></TD>
<TD><A HREF=<%=rs("Link")%>><%=rs("Description")%></A></TD>
</TR>
<%
      rs.MoveNext
   Wend
%>
<TR><TD Align=Right ColSpan=7><Font Color=Red>总价格=<%=Sum%></Font></TD></TR>
</TABLE>
<Input Type=Submit Value=" 更改数量 ">
</Form>
<HR width=80%>
<A HREF=Clear.asp>退回所有物品</A><P>
<% ListCategory conn %>
<HR width=80%>
<h2>顾客信息</h2>
<form action=BuyFinish.asp Method=POST>
姓名:<input Type=text  name=Customer_N Value=""><br>
电话:<input Type=text  name=Customer_T Value=""><br>
住址:<input Type=text  name=Customer_A Value=""><br>
<Input Type=hidden Name=Customer_P Value="<%=C_ProductID%>">
<Input Type=hidden Name=Customer_PN Value="<%=C_ProductName%>">
<Input Type=hidden Name=Customer_Q Value="<%=C_Quatity%>">
<Input Type=hidden Name=Customer_S Value="<%=Sum%>">
<Input Type=Submit Value=" 提交,完成一次购物. ">
</form><HR width=80%>
</CENTER>

</BODY>
</HTML>


 
免责声明:作品版权归所属媒体与作者所有!!本站刊载此文不代表同意其说法或描述,仅为提供更多信息。如果您认为我们侵犯了您的版权,请告知!本站立即删除。有异议请联系我们。
文章录入:烟灰缸    责任编辑:烟灰缸 
网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
| 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明 | 网站公告 | 管理登录 |