急请高手解决一个问题,,先谢!

xyy7309 2009-10-06 12:04:59
图例:


请教这颜色和尺码对应的数量值如何获取提交到数据库表?
现在我的问题就是数量文本框输入的数量值没有与颜色和尺码相对应!!!
比如:颜色红色 尺码L 数量10
   颜色红色 尺码XL 数量5
   颜色黑色 尺码L 数量20
   颜色黑色 尺码XL 数量30

提交后数量就不能与这个相对应了.请高手指教,,非常感激!!!!

代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../Connections/conn.asp" -->
<%
Dim ys
Dim ys_cmd
Dim ys_numRows

Set ys_cmd = Server.CreateObject ("ADODB.Command")
ys_cmd.ActiveConnection = MM_conn_STRING
ys_cmd.CommandText = "SELECT * FROM dbo.hai_yanshe_biao"
ys_cmd.Prepared = true

Set ys = ys_cmd.Execute
ys_numRows = 0
%>
<%
Dim cm
Dim cm_cmd
Dim cm_numRows

Set cm_cmd = Server.CreateObject ("ADODB.Command")
cm_cmd.ActiveConnection = MM_conn_STRING
cm_cmd.CommandText = "SELECT * FROM dbo.hai_cm_biao"
cm_cmd.Prepared = true

Set cm = cm_cmd.Execute
cm_numRows = 0
%>
<% If Request("yid")<>"" Then %>
<%
Dim yxz
Dim yxz_cmd
Dim yxz_numRows

Set yxz_cmd = Server.CreateObject ("ADODB.Command")
yxz_cmd.ActiveConnection = MM_conn_STRING
yxz_cmd.CommandText = "SELECT * FROM dbo.hai_yanshe_biao WHERE yid in("+Request("yid")+")"
yxz_cmd.Prepared = true

Set yxz = yxz_cmd.Execute
yxz_numRows = 0
%>
<% End If %>

<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
ys_numRows = ys_numRows + Repeat1__numRows
%>
<%
Dim Repeat2__numRows
Dim Repeat2__index

Repeat2__numRows = -1
Repeat2__index = 0
cm_numRows = cm_numRows + Repeat2__numRows
%>
<%
Dim Repeat3__numRows
Dim Repeat3__index

Repeat3__numRows = -1
Repeat3__index = 0
yxz_numRows = yxz_numRows + Repeat3__numRows
%>

<!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>无标题文档</title>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
<p>
<%
While ((Repeat1__numRows <> 0) AND (NOT ys.EOF))
%>
<input <%If (Instr(1, request("yid"), (ys.Fields.Item("yid").Value), 1)<>0 ) Then Response.Write("checked=""checked""") : Response.Write("")%> name="yid" type="checkbox" id="yid" value="<%=(ys.Fields.Item("yid").Value)%>" />
<%=(ys.Fields.Item("ysmc").Value)%> 
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
ys.MoveNext()
Wend
%>
<br />

<%
While ((Repeat2__numRows <> 0) AND (NOT cm.EOF))
%>
<input <%If (Instr(1, request("cid"), (cm.Fields.Item("cid").Value), 1)<>0 ) Then Response.Write("checked=""checked""") : Response.Write("")%> name="cid" type="checkbox" id="cid" value="<%=(cm.Fields.Item("cid").Value)%>" />
<%=(cm.Fields.Item("cmmc").Value)%> 
<%
Repeat2__index=Repeat2__index+1
Repeat2__numRows=Repeat2__numRows-1
cm.MoveNext()
Wend
%>
</p>
<p>
<input type="submit" name="button" id="button" value="提交" />
</p>
</form>
<p>已经选择</p>
<form id="form2" name="form2" method="post" action="">

<% If Request("yid")<>"" and Request("cid")<>"" Then %>
<table width="100%" border="0" cellspacing="0" cellpadding="6">
<tr>
<td width="14%">颜色名称</td>
<td width="16%">尺码</td>
<td width="70%">数量</td>
</tr>
<%
While ((Repeat3__numRows <> 0) AND (NOT yxz.EOF))
%>
<%
Dim cxz
Dim cxz_cmd
Dim cxz_numRows

Set cxz_cmd = Server.CreateObject ("ADODB.Command")
cxz_cmd.ActiveConnection = MM_conn_STRING
cxz_cmd.CommandText = "SELECT * FROM dbo.hai_cm_biao WHERE cid in("+Request("cid")+")"
cxz_cmd.Prepared = true
cxz_cmd.Parameters.Append cxz_cmd.CreateParameter("param1", 5, 1, -1, cxz__MMColParam) ' adDouble

Set cxz = cxz_cmd.Execute
cxz_numRows = 0
%>

<%
Dim Repeat4__numRows
Dim Repeat4__index

Repeat4__numRows = -1
Repeat4__index = 0
cxz_numRows = cxz_numRows + Repeat4__numRows
%>
<%
While ((Repeat4__numRows <> 0) AND (NOT cxz.EOF))
%>
<tr>
<td><%=(yxz.Fields.Item("ysmc").Value)%></td>
<td><%=(cxz.Fields.Item("cmmc").Value)%></td>
<td><input type="text" name="sl<%= i %>" id="sl<%= i %>" /></td>
</tr>
<% i=i+1
Repeat4__index=Repeat4__index+1
Repeat4__numRows=Repeat4__numRows-1
cxz.MoveNext()
Wend
%> <%
Repeat3__index=Repeat3__index+1
Repeat3__numRows=Repeat3__numRows-1
yxz.MoveNext()
Wend
%>
</table><%
yxz.Close()
Set yxz = Nothing
%>
<%
cxz.Close()
Set cxz = Nothing
%>
<% End If %><%= i %><input name="zs" type="hidden" id="zs" value="<%= i %>" /></form>

</body>
</html>
<%
ys.Close()
Set ys = Nothing
%>
<%
cm.Close()
Set cm = Nothing
%>



...全文
85 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Dogfish 2009-10-06
  • 打赏
  • 举报
回复
提交后,是进数据库,然后显示。
xyy7309 2009-10-06
  • 打赏
  • 举报
回复
提交后要像这样相对应呀 !

颜色红色 尺码L 数量10
颜色红色 尺码XL 数量5
颜色黑色 尺码L 数量20
颜色黑色 尺码XL 数量30
Dogfish 2009-10-06
  • 打赏
  • 举报
回复
提交后,request("zs")包含了所有的id;

ar = split(trim(request("zs")), ",")
for i=0 to ubound(ar)
qty = request("sl" & ar(i))'这样就能拿到想对于的数量
next
xyy7309 2009-10-06
  • 打赏
  • 举报
回复
请给个详细点的...

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧