下面的代碼只適用於一個複選框,而忽略其餘部分。有什麼辦法可以讓它刪除選定的複選框?我一直在使用implode
嘗試,但它給了我多選複選框帖子表格
Warning: implode(): Invalid arguments passed
<form action="" method="post">
<input type="checkbox" name="id" class="check" value = "<?php echo $row['id']; ?>">
<?php echo $row['to_user'];?>
<input type="submit" name="delete">
</form>
<?php
if (isset($_POST['delete'])) {
$id = $_POST['id'];
$ids = implode(',', $id);
$mydb = new mysqli('localhost', 'root', '', 'database');
$stmt = $mydb->prepare("update messages set deleted = 'yes' where from_user = ? and id = ? ");
$stmt->bind_param('ss', $user, $ids);
$stmt->execute();
echo "Message succesfully deleted";
exit();}
?>
那麼表單代碼是什麼? –
implode部分在哪裏?只有一個輸入 –
@EmilioGort我現在已經包含了它。 –