?? buy.asp
字號:
<!--#include file="conn.asp"-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%if session("user_name")<>"" then%>
<%=session("user_name")%>的購物籃
<%else
response.write "購物籃"
end if%>
</title>
<link href=style.css rel=STYLESHEET type=text/css>
<%
if session("user_name")="" then
response.write "<center>"
response.write "你尚未登錄或不是本站會員!"
response.write "<br>請登錄后再訂購本站貨物!"
response.end
end if
dim sql,rs
set rs=server.createobject("adodb.recordset")
if request("action")="buy" then
if request("count")="" then
count=1
else
count=request("count")
end if
if request("hw_id")="" then
response.write "沒有此貨物!"
else
hw_id=request("hw_id")
end if
sql="select * from basket where hw_id='"&hw_id&"' and user_name='"&session("user_name")&"' and basket_check=false"
rs.open sql,conn,3,3
if rs.eof then
rs.addnew
rs("hw_id")=hw_id
rs("user_name")=session("user_name")
rs("basket_count")=count
rs("basket_date")=now()
rs("hw_name")=request("hw_name")
rs("hw_cash")=request("hw_cash")
else
rs("basket_count")=int(rs("basket_count"))+int(count)
end if
rs.update
rs.close
%>
</head>
<%end if%>
<center>
<table border="0" width="400" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" bgcolor="#FF9933" height="18">
<p align="center">當前你已訂購的商品</td>
</tr>
<tr>
<td width="100%">
<table border="0" width="100%" cellspacing="1">
<tr>
<td width="100%">
<table border="1" width="390" bordercolor="#66CCFF" cellspacing="0" cellpadding="0">
<tr>
<td width="64">商品編號</td>
<td width="64">商品名稱</td>
<td width="65">商品單價</td>
<td width="65">訂購數(shù)量</td>
<td width="65">訂購時間</td>
<td width="65">合計</td>
</tr>
<%sql="select * from basket where user_name='"&session("user_name")&"' and basket_check=false"
rs.open sql,conn,3,3
do while not rs.eof%>
<tr>
<td width="64"><%=rs("hw_id")%></td>
<td width="64"><a href="clear.asp?basket_id=<%=rs("basket_id")%>"><%=rs("hw_name")%></a></td>
<td width="65"><%=rs("hw_cash")%>元</td>
<td width="65"><%=rs("basket_count")%></td>
<td width="65"><%=rs("basket_date")%></td>
<td width="65"><%=rs("hw_cash")*rs("basket_count")%>元</td>
<%totalcash=totalcash+(rs("hw_cash")*rs("basket_count"))%>
</tr>
<%rs.movenext
loop
rs.close
%><tr>
<td width="321" colspan="5">總計:</td>
<td width="65"><%=totalcash%>元</td>
</table>
</td>
</tr><tr><td></td></tr>
<tr><td><a href="buy.asp">查看購物欄</a> <a href="cash.asp" target="blank">收銀臺</a>
<a href="clear.asp">清空購物欄</a></td></tr>
</table>
</td>
</tr>
</table>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -