如何通过表格中的表单发送复选框状态 [英] How to send checkbox state through form in a table
本文介绍了如何通过表格中的表单发送复选框状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面的表单包含一个带有复选框作为输入类型的表
当我做一个var_dump的_POST时,每个复选框的值不通过
Below form contains a table with checkboxes as a input type when I do a var_dump of _POST the values of each check box doesn't come through
<form method="post" action="index.php?option=com_content&view=article&id=3" name="details" >
<div id="table_container">
<table class="z">
<thead>
<tr>
<th>Select</th>
<th>Last Name</th>
<th>First Name</th>
<th>Street Num</th>
<th>Street Name</th>
<th>City</th>
<th>State</th>
<th>Zip</th>
<th>Phone</th>
</tr>
</thead>
<tbody>
<?
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
?>
<tr>
<td style="text-align: center; vertical-align: middle;">
<input type="checkbox" name="<?echo $row['UUID'];?>">
</td>
<td><?echo $row['last_name'];?></td>
<td><?echo $row['first_name'];?></td>
<td><?echo $row['street_num'];?></td>
<td><?echo $row['street_name'];?></td>
<td><?echo $row['city'];?></td>
<td><?echo $row['state'];?></td>
<td><?echo $row['zip'];?></td>
<td><?echo $row['phone'];?></td>
</tr>
<?
}
?>
</tbody>
</table>
</div>
<input type="hidden" id="type" name="type" value="4">
<input type="submit" value="Place On Hold">
</form>
推荐答案
所以我想你想做的是。如果我理解正确。
So I think what you want to do is this though. If I understand it correctly.
<input type="checkbox" name="UUID[]" value="<?echo $row['UUID'];?>">
现在当你发布的页面,你将有一个名为UUID的数组在POST中,每个UUID选择。
Now when you post the page you will have an array called UUID in the POST with each UUID selected.
这篇关于如何通过表格中的表单发送复选框状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文