⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 buy.asp

📁 ASP入门与提高实用教程 源文件(上传网站)
💻 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">订购数量</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>&nbsp; <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 + -