一个简单的网上书城的例子(四)

check.asp:用户察看所购物品!

 1   
 2Head="以下是您所选购的物品清单"   
 3  
 4ProductList = Session("ProductList")   
 5If Len(ProductList) = 0 Then Response.Redirect "Nothing.asp"   
 6  
 7DbPath = SERVER.MapPath("ShopBag.mdb")   
 8Set conn = Server.CreateObject("ADODB.Connection")   
 9conn.open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DbPath   
10  
11If Request("MySelf") = "Yes" Then   
12ProductList = ""   
13Products = Split(Request("ProductID"), ", ")   
14For I=0 To UBound(Products)   
15PutToShopBag Products(I), ProductList   
16Next   
17Session("ProductList") = ProductList   
18Session("First")="no"   
19End If   
20  
21sql = "Select * From Products"   
22sql = sql & " Where ProductID In (" & ProductList & ")"   
23sql = sql & " Order By ProductID"   
24Set rs = conn.Execute( sql )   
 1<html>
 2<head><title>```
 3=Head
 4```</title></head>
 5<body background="b01.jpg">
 6<h2 align="CENTER">```
 7=Head
 8```</h2>
 9<center>
10<form action="Check.asp" method="POST">
11<input name="MySelf" type="Hidden" value="Yes"/>
12<table border="1">
13<tr bgcolor="#00FFFF">
14<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_" &amp; rs("ProductID")) )
If Quatity &lt;= 0 Then
Quatity = CInt( Session(rs("ProductID")) )
If Quatity&lt;=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 = "" &amp; rs("ProductID") &amp; ""
C_ProductName = "" &amp; rs("ProductName") &amp; ""
C_Quatity = "" &amp; Quatity &amp; ""
Else
C_ProductID = C_ProductID &amp; "/" &amp; rs("ProductID") &amp; ""
C_ProductName = C_ProductName &amp; "/" &amp; rs("ProductName") &amp; ""
C_Quatity = C_Quatity &amp; "/" &amp; Quatity &amp; ""
End If

 1<tr>
 2<td align="Center">
 3<input ```"="" checked="" name="ProductID" productid")="" type="CheckBox" value="```
 4=rs("/>
 5</td>
 6<td>```
 7=rs("ProductID")
 8```</td>
 9<td>```
10=rs("ProductName")
11```</td>
12<td align="Right">```
13=rs("Price")
14```</td>
15<td><input &="" =quatity="" ```="" ```"="" name="```
16=" q_"="" rs("productid")="" size="3" type="Text" value="```"/></td>
17<td align="Right">```
18=CDbl(rs("Price"))*Quatity
19```</td>
20<td><a =rs("link")="" ```="" href="```">```
21=rs("Description")
22```</a></td>
23</tr>   

rs.MoveNext
Wend

1<tr><td align="Right" colspan="7"><font color="Red">总价格=```
2=Sum
3```</font></td></tr>
4</table>
5<input type="Submit" value=" 更改数量 "/>
6</form>
7<hr width="80%"/>
8<a href="Clear.asp">退回所有物品</a><p>   

ListCategory conn

 1<hr width="80%"/>
 2<h2>顾客信息</h2>
 3<form action="BuyFinish.asp" method="POST">   
 4姓名:<input name="Customer_N" type="text" value=""/><br/>   
 5电话:<input name="Customer_T" type="text" value=""/><br/>   
 6住址:<input name="Customer_A" type="text" value=""/><br/>
 7<input name="Customer_P" type="hidden" value="```
 8=C_ProductID
 9```"/>
10<input name="Customer_PN" type="hidden" value="```
11=C_ProductName
12```"/>
13<input name="Customer_Q" type="hidden" value="```
14=C_Quatity
15```"/>
16<input name="Customer_S" type="hidden" value="```
17=Sum
18```"/>
19<input type="Submit" value=" 提交,完成一次购物. "/>
20</form><hr width="80%"/>
21</p></center>
22</body>
23</html>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus