Originally posted by Valord
<input type=checkbox name=remove[] value=$value>
Replace that line with:
<input type=hidden name=id[$count] value=$id_from_your_table>
<input type=checkbox name=remove[$count]>
You'll need to have a variable set as $count=0; outside the loop where you're printing out the checkboxes and other info.
Originally posted by Valord
Update.php
foreach($_POST['remove'] as $value){
$sql = "DELETE FROM main WHERE index = $value";
mysql_query($sql);
Replace that foreach loop with a for loop instead:
for($i=0;$i<=$count;$i++){
if($remove[$i] == "on"){
$sql = "DELETE FROM main WHERE id = 'id[$i]'";
mysql_query($sql);
}
}
That's how I handle these situations, my syntax may be off, but give it a shot!