1
Good morning guys, I need help :( The thing is, I need to delete several records at once so I need to select the ID of each record, so I did an input with checkbox inside the loop this way:
<form method="POST" id="formDeletarMsg" action="deletarMsg.php">
<input type="checkbox" name="msg[]" value="<?php echo $idMsg; ?>">
</form>
Button Submit is out of the form, I am using javascript as it will be in the footer of Section.
And I’m using a foreach to display the data of each checkbox, it even works, only it displays only the first checkbox marked, if I mark the second or the third does not display anything, if I mark the first displays:
if(isset($_POST['msg'])){
$msg = $_POST['msg'];
foreach($msg as $key => $value){
echo $key . "<br>";
echo $value;
}
var_dump($value);
}
Hello Vinicius, you don’t want to post a piece of code to help other users who have the same problem?
– Anthony Accioly
Just take the form out of the loop, I’ll edit my answer
– viniciussvl