求助-如何实现asp循环表格中的表单以及修改数据
用asp循环读出数据库的表格以及表单,同时可以在表单的文本框中修改数据重新提交。我的表单位置放在<tr></tr>外面,可以循环但是表格乱了,错行了,看下我的截图(下面)序号跑到表格上面自己建了一行,郁闷,而且也无法修改数据。
我知道form表单应该写在表格外面,但是那样循环的话就无法对齐最上边的标题了。
大家帮我看看到底该怎么写啊?
程序代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%><!--#include file="conn.asp"--> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.> <html xmlns="http://www.> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>青岛泽多木制品家具在线管理系统</title> <link href="css.css" rel="stylesheet" type="text/css" /></head> <%if Request.QueryString("no")="eshop" then uid=request("id") title=request("title") guige=request("guige") caizhi=request("caizhi") zhongliang=request("zhongliang") jiage10=request("jiage10") jiage50=request("jiage50") jiage100=request("jiage100") jiagepf=request("jiagepf") fenlei=request("fenlei") zhuangtai=request("zhuangtai") If title="" Then response.write "SORRY <br>" response.write "请输入更新内容!!<a href=""javascript:history.go(-1)"">返回重输</a>" response.end end if If guige="" Then response.write "SORRY <br>" response.write "请输入更新内容!!<a href=""javascript:history.go(-1)"">返回重输</a>" response.end end if If zhongliang="" Then response.write "SORRY <br>" response.write "请输入更新内容!!<a href=""javascript:history.go(-1)"">返回重输</a>" response.end end if If jiage10="" Then response.write "SORRY <br>" response.write "请输入更新内容!!<a href=""javascript:history.go(-1)"">返回重输</a>" response.end end if If jiage50="" Then response.write "SORRY <br>" response.write "请输入更新内容!!<a href=""javascript:history.go(-1)"">返回重输</a>" response.end end if If jiage100="" Then response.write "SORRY <br>" response.write "请输入更新内容!!<a href=""javascript:history.go(-1)"">返回重输</a>" response.end end if If jiagepf="" Then response.write "SORRY <br>" response.write "请输入更新内容!!<a href=""javascript:history.go(-1)"">返回重输</a>" response.end end if Set rs1 = Server.CreateObject("ADODB.Recordset") sql="select * from cp where id="&uid rs1.open sql,conn,1,3 rs1("title")=title rs1("guige")=guige rs1("caizhi")=caizhi rs1("zhongliang")=zhongliang rs1("jiage10")=jiage10 rs1("jiage50")=jiage50 rs1("jiage100")=jiage100 rs1("jiagepf")=jiagepf rs1("fenlei")=fenlei rs1("zhuangtai")=zhuangtai rs1.update rs1.close response.redirect "index_1.asp" end if %> <% sql="select * from cp order by id desc" dim page,pages,rspagesize,rscount,rscounts page=int(request.QueryString("page")) if page <= 0 then page = 1 rspagesize=25 rscount=rspagesize set rs=Server.CreateObject("adodb.recordset") rs.open sql,conn,1,1 rs.PageSize=rspagesize if not rs.eof then rs.AbsolutePage=page rscounts=rs.RecordCount pages=rs.PageCount %> <body> <table width="1000" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#E7FEF7"> <tr> <td align="center" class="a1">序号</td> <td align="center" class="a1">标题</td> <td align="center" class="a1">缩略图</td> <td align="center" class="a1">规格</td> <td align="center" class="a1">材质</td> <td align="center" class="a1">重量</td> <td align="center" class="a1">10套</td> <td align="center" class="a1">50套</td> <td align="center" class="a1">100套</td> <td align="center" class="a1">批发价</td> <td align="center" class="a1">分类</td> <td align="center" class="a1">状态</td> <td align="center" class="a1">操作</td> </tr> <% while not rs.eof and rscount>0 %> <tr> <td colspan="13" class="a3"> </td> </tr> <form name="cn_bruce" method="POST" action="index_1.asp?no=eshop> <tr> <td align="center" class="a1"><%=rs("id")%></td> <td align="center" class="a1"><input name="title" size="10" type="text" value="<%=rs("title")%>" /> </td> <td align="center" class="a1"><img name="<%=rs("title")%>" src="<%=rs("pic")%>" width="20" height="20" alt="<%=rs("title")%>" style="background-color: #999999" /></td> <td align="center" class="a1"><input name="title" size="12" type="text" value="<%=rs("guige")%>" /></td> <td align="center" class="a1"><input name="title" size="8" type="text" value="<%=rs("caizhi")%>" /></td> <td align="center" class="a1"><input name="title" size="4" type="text" value="<%=rs("zhongliang")%>" /></td> <td align="center" class="a1"><input name="title" size="4" type="text" value="<%=rs("jiage10")%>" /></td> <td align="center" class="a1"><input name="title" size="4" type="text" value="<%=rs("jiage50")%>" /></td> <td align="center" class="a1"><input name="title" size="4" type="text" value="<%=rs("jiage100")%>" /></td> <td align="center" class="a1"><input name="title" size="4" type="text" value="<%=rs("jiagepf")%>" /></td> <td align="center" class="a1"> <select name="fenlei" id="fenlei"> <option value="分类" selected="selected">分类</option> <% set cl=conn.execute("select * from cp_fenlei") while not cl.eof %> <option value="<%=cl("fenlei")%>" <%if cl("fenlei")=rs("fenlei") then response.Write("selected")%>><%=cl("fenlei")%></option> <% cl.movenext wend %> </select> </td> <td align="center" class="a1"><select name="zhuangtai" id="zhuangtai"> <option value="状态" selected="selected">状态</option> <% set cl1=conn.execute("select * from zhuangtai") while not cl1.eof %> <option value="<%=cl1("fenlei")%>" <%if cl1("fenlei")=rs("zhuangtai") then response.Write("selected")%>><%=cl1("fenlei")%></option> <% cl1.movenext wend %> </select> </td> <td align="center" class="a1"><label> <input type="submit" name="Submit" value="提交" /> </label></td> </tr></form><% rs.movenext rscount=rscount-1 wend %> <tr> <td height="30" colspan="13" align="center" class="a3">共<%=rscounts%>条 | 共<%=pages%>页 | <%=rspagesize%>条/页 | <select name="select" style="font-size:12px;" onchange="location.href='index_1.asp?ctype=<%=ctype%>&page='+this.value;"> <%for i=1 to pages%> <option value="<%=i%>" <%if page=i then response.Write("selected")%>>第<%=i%>页</option> <%next%> </select> <%if page>1 then%> <a href="index_1.asp?ctype=<%=ctype%>&page=1">首页</a> <a href="index_1.asp?ctype=<%=ctype%>&page=<%=page-1%>">上页</a> <%end if if page < pages then%> <a href="index_1.asp?ctype=<%=ctype%>&page=<%=page+1%>">下页</a> <a href="index_1.asp?ctype=<%=ctype%>&page=<%=pages%>">末页</a> <%end if%></td> </tr> </body> </html>