【发布时间】:2014-04-02 21:31:11
【问题描述】:
我在使用复选框的值从数据库中删除行时遇到问题。 如果我选择更多复选框,它只会删除所选行之一。
我的 PHP 代码:
// Here I didn't know how to put the value of all checkboxes into one variable.
$intChk = array();
$intChk = $_POST['chk'];
/* ..... */
$stmt = $mysqli->prepare("DELETE FROM follow WHERE id = ?");
$stmt->bind_param('s', $intChk);
$stmt->execute();
$stmt->close();
我的 HTML 代码:
<input type="checkbox" id="chk" class="checkbox" value="<?php echo $followId; ?>" name="chk[]">
感谢您的帮助!
【问题讨论】: