简体   繁体   English

如何从经典ASP中的HTML表发布数据

[英]How to Post Data from HTML Table in Classic ASP

I'm trying to post some field data from my HTML table to a new page, but I can't seem to get my hidden input value to be anything other than null. 我正在尝试将HTML表格中的某些字段数据发布到新页面,但似乎无法将隐藏的输入值设置为null以外的任何值。 Every row in the table has a Details button that I want to post just the primary key from that table to the posted page. 表格中的每一行都有一个“详细信息”按钮,我只想将该表中的主键发布到已发布的页面上。 Here's what I've tried that doesn't work: 这是我尝试过的不起作用的方法:

<tr VALIGN="top">
    <td>
        <input type="submit" value="Details" /> 
        <input type= "hidden" name = "post" value=<%rs.Fields(1).Name%>/>
    </td>
<% For I = 0 to rs.fields.count - 1 %>
<td BORDERCOLOR="#c0c0c0"><font SIZE="1" FACE="Arial" COLOR="#000000"><%=(rs.Fields(I).Value) & "&nbsp;"%><br></font>
</td>
<%next%>

I've also tried a few other variations, but I'm sure there's a simple way to do this, I couldn't figure it out. 我还尝试了其他一些变体,但是我敢肯定有一种简单的方法可以做到这一点,我无法弄清楚。 If you need more info let me know, thanks 如果您需要更多信息,请告诉我,谢谢

EDIT: 编辑:

rs.Fields(1).Name has a value when I do Response.Write directly above the posted code, so I know that the result is not null. rs.Fields(1).Name在发布代码正上方执行Response.Write时具有值,因此我知道结果不为null。

我认为您缺少Response.Write或简短形式<%=%>(您仍然需要将值输出到HTML!)

<input type= "hidden" name = "post" value="<%= rs.Fields(1).Name %>" />

我不确定它是否会影响它,但是请尝试使用“ =”周围的空格:

<input type="hidden" name="post" value=<%rs.Fields(1).Name%> />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM