1 回答

TA贡献1799条经验 获得超9个赞
好的,在第一段代码中创建表单,使用主键作为复选框的值:
<div class="tab-pane" id="TLL">
<table class="table table-bordered" style="color: Black" id="table-3">
<?php
$control_info= $this->db->query("select *
from controlsemanal
where vendedora = 'Taller'
and Indicador != '1'
and Indicador !='100'
ORDER BY FIELD (Id_Status,1,3,4,5,6,2,7,0) ");
?>
<thead> etc etc </thead>
<tbody>
<?php
$arr_loop = $control_info;
foreach ($arr_loop->result_array() as $row) {
?>
<tr> <th>
<div>
<input type="checkbox" name="check[]" value="<?php echo $row['referencia']; ?>">
</div>
</th>
etc etc
</tr>
<?php
} // I guess foreach ends here
?>
</tbody>
</table>
然后,在您的第二个表格(处理$ _POST表单)中,仅获得标记的项目:
check
必须是一个数组,包含 每个标记的项目reference
未标记的复选框不会与表单一起发送
从他们那里列出一个列表以创建过滤器“ref1,ref2,...雷夫克斯”
我猜你的参考列是数字,如果没有,评论,我会修复查询
$referencias = (isset($_POST['check'])) ? implode(', ', $_POST['check']) : '';
// Create your query, filtering by $references
$control_info= $this->db->query("select *
from controlsemanal
where vendedora = 'Taller'
and referencia IN ($referencias)
ORDER BY FIELD (Id_Status,1,3,4,5,6,2,7,0) ");
// Create your table here
- 1 回答
- 0 关注
- 164 浏览
添加回答
举报