| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 629 人关注过本帖
标题:请教两个关于购物车的问题
只看楼主 加入收藏
chenjm2004
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2007-9-3
收藏
 问题点数:0 回复次数:4 
请教两个关于购物车的问题

因为对asp不是很在行
想请教两个关于购物车的问题
1、如何保存下拉框的值,想写入session,原有的session只保存商品的ID,不知道怎么改。
2、如何点删除字样删除一个商品。

最主要的第一个问题,不尽感激~~(-_-)

源代码如下

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>kylin-trade</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<!--#include file="include/conn.asp" -->
<!--#include file="include/include.asp" -->
<!--#include file="chk_user.asp" -->
</head>

<body>
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="80">&nbsp;</td>
</tr>
<tr>
<td>
<%
if request("ProductList")="ProductList" then
Session("ProductList")=""
response.Write("<script>alert('Your Inquiry Basket is Empty!');window.location.href='index.asp';</script>")
end if

ProductList = Session("ProductList")
Products = Split(Request("Prodid"), ",")
For I=0 To UBound(Products)
PutToShopBag Products(I), ProductList
Next
Session("ProductList") = ProductList

Sub PutToShopBag( Prodid, ProductList )
If Len(ProductList) = 0 Then
ProductList =Prodid
ElseIf InStr( ProductList, Prodid ) <= 0 Then
ProductList = ProductList&", "&Prodid &""
End If
End Sub

If Request("update") = "update" Then
ProductList = ""
Products = Split(Request("ProdId"), ", ")
For I=0 To UBound(Products)
PutToShopBag Products(I), ProductList
Next
Session("ProductList") = ProductList
End If

If Len(Session("ProductList")) = 0 Then
response.Write("<script>alert('Your Inquiry Basket is Empty!');window.location.href='index.asp';</script>")
Response.end
end if
%>
<form action="gouwu.asp" method="POST" name="check">
<table width="760" border="0" cellpadding="0" cellspacing="1" bgcolor="#C7D9C0">
<%
Set rs=Server.CreateObject("ADODB.RecordSet")
strsql="select * from shangpin where ID in ("&Session("ProductList")&") order by ID"
rs.open strsql,conn,1,1
%>
<tr>
<td height="30" colspan="5" align="center" bgcolor="#EAF5E6">Goods information chosen</td>
</tr>
<tr>
<td width="80" height="30" align="center" bgcolor="#FAFDF9">Number</td>
<td width="206" align="center" bgcolor="#FAFDF9">Product Name</td>
<td width="188" align="center" bgcolor="#FAFDF9">Picture</td>
<td width="140" align="center" bgcolor="#FAFDF9">Size</td>
<td width="140" align="center" bgcolor="#FAFDF9">Quantity</td>
</tr>
<%
Quantity = 1
Do While Not rs.EOF
Quantity = Request.Form( "Q_" & rs("ID"))
If Quantity <= 0 Then
Quantity = Session(rs("ID"))
If Quantity <= 0 Then Quantity = 1
End If
Session(rs("ID")) = Quantity
%>
<tr>
<td height="70" align="center" bgcolor="#FFFFFF"><input type="checkbox" name="ProdId" value="<%=rs("ID")%>" Checked

/></td>
<input type="hidden" name="shuliang" value="<%=Quantity%>">
<td height="70" align="center" bgcolor="#FFFFFF"><a href="lookpro.asp?ID=<%=rs("ID")%>" target="_blank"

class="blue"><%=rs("mingchen")%></a></td>
<td align="center" bgcolor="#FFFFFF"><a href="lookpro.asp?id=<%=rs("id")%>" target="_blank"><img src="upfile/<%=rs

("tupian")%>" width="75" height="56" border="0" alt="<%=rs("mingchen")%>" /></a></td>
<td align="center" bgcolor="#FFFFFF">
<select name="chicun">
<%
set rs2=Server.CreateObject("ADODB.Recordset")
sql2="select chicun from shangpin where ID in (" & Session("ProductList") & ") order by ID"
rs2.open sql2,conn,1,1
dim chicun,i
chicun=rs("chicun")
if chicun<>"" then
chicun=split(chicun, ",")
for i=0 to ubound(chicun)
%>
<option value="<%=chicun(i)%>"><%=chicun(i)%></option>
<%
next
end if
rs2.close
set rs2=nothing
%></select>
</td>
<td align="center" bgcolor="#FFFFFF"><input name="<%="Q_" & rs("ID")%>" type="text" value="<%=Quantity%>" size="4"

/></td>
</tr>
<%
rs.movenext
loop
rs.close
set rs=nothing
%>
<tr>
<td height="40" colspan="5" align="center" bgcolor="#FAFDF9"><a href="index.asp"><img src="images/btn_continue.gif"

width="77" height="20" border="0" /></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="image" name="order"

src="images/btn_update.gif" width="63" height="20" border="0" style="curser:hand" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a

href="gouwu.asp?ProductList=ProductList"><img src="images/btn_clear.gif" width="63" height="20" border="0"

/></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="shouyin.asp"><img name="payment" src="images/btn_payment.gif" width="77"

height="20" border="0" /></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="hidden" name="update" value="update"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>

搜索更多相关主题的帖子: 购物车 源代码 DTD target 
2007-11-08 23:40
jacksontv
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2007-11-9
收藏
得分:0 
2007-11-09 01:30
做人不厚道
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2007-11-5
收藏
得分:0 
的顶下......

2007-11-09 03:23
做人不厚道
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2007-11-5
收藏
得分:0 
继续顶下.....

2007-11-09 03:30
chenjm2004
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2007-9-3
收藏
得分:0 
谢谢帮顶~~
2007-11-09 22:17
快速回复:请教两个关于购物车的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018168 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved