buy.asp:顯示商品和使用者購物!

來源:互聯網
上載者:User
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>


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.