I have been searching on this topic and the more I read the more confused I get. I hope you can help me on this.
My objective is to add checkboxes to a table in order to be able to delete the rows I select from that table. So my code til now is like this:
if ($arch = $pdo->prepare("SELECT name, age FROM table WHERE id = ?)) {
$arch ->execute(array($id));
$data = $arch->fetchAll();
echo '<div class="coolTable" ><table><tr><td>Name</td><td>Age</td><td>Check</td></tr>';
foreach ($data as $row){
echo '<tr>';
foreach ($row as $col){
$col=nl2br($col);
echo '<td>'.$col.'</td>';
}
echo '<td><input type="checkbox" name="checkbox" value="" id="checkbox"></td>';
echo '</tr>';
}
echo '</table></div>';
}
With this, I have all my checkboxes in place. But now, how can I submit the checkboxes with a Post so I can Delete the rows I checked?
I suppose I can use an array to name each checkbox? but don`t know how :-s
Thanks in advance for your help!