0

我有一个工作动态图像和文本列表页面,以表格形式显示结果。我使用下面的(相关)代码为列表结果中的每个项目添加了复选框(名称 =“选择”)。我想从 select ="1" 中过滤相应的 art_id

echo "<tr align=\"left\" padding=\"1\"> 
                <td align=\"left\" width=\"0%\" height=\"120\" >
    <a href=\"$path$image_link\">
              <img src=\"$path$image_link\" height=\"85\" width=\"85\"></a><br />
    </td>
    <td align=\"left\" width=\"0%\">
//CHECKBOXES ADDED HERE  <input name=\"select\" type=\"checkbox\" value=\"1\" >
    <input name=\"art_id\" type=\"hidden\" value=\"$art_id\" />
    </td>

然后我想通过 $_POST 发送到另一个页面以进行另一个查询/回显。我猜想这样的事情来抓取第二页上的变量:

$t_art_id =  $_POST["art_id"], ["select ='1'"];

将不胜感激任何关于正确方法的好主意。

谢谢艾伦

4

2 回答 2

1

你可以用简单的方式做;

像这样 :

     <input name="checkbox"   type="checkbox" class="checkbox" onClick="Compressartid('<?php echo $art_id; ?>',this)" ?>> 

在 Compressartid 函数中,将勾选的 id 存储在隐藏字段中,并将隐藏字段中的 id 用作选定的 id。

我希望它会有所帮助:)。干杯。

于 2010-10-23T06:01:54.303 回答
0

为什么不只使用复选框?

虽然仅在选中该框时才提交复选框的值,但您不需要在服务器端确定复选框的值是否已选中(POST-Array 中的出现就足够了)。所以可以使用value-attribute提交art_id

<input name=\"select[]\" type=\"checkbox\" value=\"$art_id\" />

您目前拥有它的方式没有机会获得复选框和隐藏输入之间的关系。

于 2010-10-22T23:28:19.210 回答