欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2023-02-18 14:09:04
buy.:显示商品和用户购物!<%dbpath = server.mappat...
buy.:显示商品和用户购物!

<!--#include file="util.asp" -->
<%
dbpath = server.mappath("shopbag.mdb")
set conn = server.createobject("adodb.connection")
conn.open "driver={microsoft access(小型网站之最爱) driver (*.mdb)};dbq=" & dbpath

categoryid=request("categoryid")
description=request("description")
head="会文书城[" & description & "] 区"

sql = "select * from products where categoryid=" & categoryid
sql = sql & " order by productid"
set rs = conn.execute( sql )

%>


<html>
<head><title><%=head%></title></head>
<body background="b01.jpg">
<font color=blue><h2 align=center><%=head%></h2></font>
<center>
<form action=add.asp method=post>
<table border=1>
<tr bgcolor=#00ffff>
<td>挑选</td><td>书刊编号</td><td>书刊名称</td><td>价格</td><td>书刊简介</td></tr>
<%
   while not rs.eof
     ischeck=""
     if instr(session("productlist"), rs("productid")) > 0 then
        ischeck="checked"
     end if
%>
<tr>
<td align=center>
<input type=checkbox name="productid" value="<%=rs("productid")%>" <%=ischeck%>>
</td>

<td><%=rs("productid")%></td>
<td><%=rs("productname")%></td>
<td align=right><%=rs("price")%></td>
<td><a href=<%=rs("link")%>><%=rs("description")%></a></td>
</tr>
<%
      rs.movenext
   wend
%>
</table>
<input type=submit value="放入购物袋">
</form>
<hr width=70%>
<a href=check.asp>查看购物袋</a>  
<a href=clear.asp>退回所有物品</a><p>
<% listcategory conn %>
</center>
</body>
</html>