What's wrong?
prepare("delete from class where name=?"); $stmt2->execute(array($_POST['name'])); } ?>
Reply content:
What's wrong?
prepare("delete from class where name=?"); $stmt2->execute(array($_POST['name'])); } ?>
Your code is rather strange to write.
First say why can't delete:
The box for your input does not have the Value property. So your $_post[' name ' doesn't get a value.
You can change it into
echo ''.$v['name'].'';
Then I look at your code, do you want to do a long choice to delete it? Then you need post to submit an array to PHP, then you can modify the Name property of input:
echo ''.$v['name'].'';
Then the post that was received with PHP is this:
$name = $_POST['name'];//array(name1,name2....)
At this point you need to deal with this $name. Change your SQL statement to
delete from class where name in (name1,name2,name3...)
such as the following:
$sql = "delete from class where name in (" . trim(str_repeat('?,',count($name)),',') . ")";$stmt2 = $pdo->prepare($sql);$stmt2->execute($name);
Then, your judgment Is_post code is best in the output list before, otherwise, first give you output, after deletion, see no effect.
Is this just getting started?