注册 登录
编程论坛 ASP技术论坛

表单传值的问题!

fujian567 发布于 2010-07-27 23:25, 717 次点击
第一个页面
<!-- #include file="config/conn.asp" -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title> </title>
<style type="text/css">
<!--
.STYLE1 {color: #000000}
-->
</style>
</head>
<body>
<%
dim rst,sql
set rst=server.createobject("adodb.recordset")
sql="select * from [kucun],[fenlei] where k_upid=3 "
rst.open sql,conn,1,1
%>
 <table width="97%" border="1" align="center"cellpadding="0" cellspacing="0"  bordercolor="#FFFFFF" bordercolorlight="#9CA6C6" bordercolordark="#CCE3FF">
    <form action="2.asp" method="post" name="form1" onSubmit="return checkForm(this)">
    <tr bgcolor="#CCE3FF">
      <td width="20%" height="23" align="center" bgcolor="#CCE3FF">商品编号:</td>
      <td bgcolor="#CCE3FF"><%=rst("k_bid")%>
      <input type="hidden" name="k_bid"></td>
    </tr>
    <tr bgcolor="#CCE3FF">
      <td width="20%" height="23" align="center" bgcolor="#CCE3FF">商品名称:</td>
      <td bgcolor="#CCE3FF"><%=rst("k_name")%>
      <input type="hidden" name="k_name"></td>
    </tr>
    <tr bgcolor="#CCE3FF">
      <td height="23" align="center" bgcolor="#CCE3FF">商品价格:</td>
      <td ><%=rst("k_price2")%>
      <input type="hidden" name="k_price2"></td>
    </tr>
    <tr bgcolor="#CCE3FF">
      <td height="23" align="center" bgcolor="#CCE3FF">销售数量:</td>
      <td ><input name="num" type="text" ></td>
    </tr>
    <tr bgcolor="#CCE3FF">
      <td height="23" align="center" bgcolor="#CCE3FF">实  收:</td>
      <td><input name="shishou" type="text" >
        <font color="#FF0000"> *</font></td>
    </tr>
    <tr bgcolor="#CCE3FF">
      <td height="31" colspan="2">        <div align="center">
          <input type="submit" name="Submit" value="确定" />
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
           <input type="reset" name="Submit2" value="清除" />
      </div></td>
   </tr>
   </form>
</table>

</body>
</html>
第二个页面的内容
<!-- #include file="config/conn.asp" -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title> </title>
<style type="text/css">
<!--
.STYLE1 {color: #000000}
-->
</style>
</head>
<body>
 <table width="97%" border="1" align="center"cellpadding="0" cellspacing="0"  bordercolor="#FFFFFF" bordercolorlight="#9CA6C6" bordercolordark="#CCE3FF">
    <tr bgcolor="#CCE3FF">
      <td width="20%" height="23" align="center" bgcolor="#CCE3FF">商品编号:</td>
      <td bgcolor="#CCE3FF"><%=request.Form("k_bid")%></td>
    </tr>
    <tr bgcolor="#CCE3FF">
      <td width="20%" height="23" align="center" bgcolor="#CCE3FF">商品名称:</td>
      <td bgcolor="#CCE3FF"><%=request.Form("k_name")%></td>
    </tr>
    <tr bgcolor="#CCE3FF">
      <td height="23" align="center" bgcolor="#CCE3FF">商品价格:</td>
      <td ><%=request.Form("k_price2")%></td>
    </tr>
    <tr bgcolor="#CCE3FF">
      <td height="23" align="center" bgcolor="#CCE3FF">销售数量:</td>
      <td ><%=request.Form("num")%></td>
    </tr>
    <tr bgcolor="#CCE3FF">
      <td height="23" align="center" bgcolor="#CCE3FF">实  收:</td>
      <td><%=request.Form("shishou")%></td>
    </tr>
</table>
</body>
</html>
第一个表单中只有文本域的内容可以传到第二页面,别的内容都无法传过来!
3 回复
#2
gupiao1752010-07-28 01:03
<td ><%=rst("k_price2")%>
      <input type="hidden" name="k_price2"></td>
这里是空的,没有值,隐藏域应该这样吧:
<td><input type="hidden" name="k_price2" value="<%=rst("k_price2")%>"></td>
#3
魏兴耀2010-07-28 07:46
隐藏域就是隐藏在客户端页面中,是看不见的,
当用户提交时,这些你原先定义的内容就会随着客户端填写的内容一起传到服务器,
所以你在上面的:<input type="hidden" name="k_name">是不对的,
你应该把值
<%=rst("k_name")%>放到里面,楼上版主的是对的
#4
fujian5672010-07-28 14:04
谢谢,楼上各位兄弟,问题终于解决了!
1