The codes are large, so I made a smaller, more simpler version. They're pretty much the same thing. What's wrong with them? D: I was thinking it was mostly the foreach part. I don't know why it used to work and now it's not. D:
<?
include"config.php";
echo"<form name=\"form\" method=\"post\" action=\"delete.php\">";
$result = mysql_query("select * from mail where touser = '$userid' ORDER BY id DESC");
$rows = mysql_num_rows($result);
while($r=mysql_fetch_array($result)){
echo"$r[subject] - <input name=\"checkbox[$r[id]]\" type=\"checkbox\" id=\"checkbox[$r[id]]\" value=\"$r[id]\">
";
}
echo"<input name=\"delete\" type=\"submit\" value=\"Delete\"></form>";
?>
And this would be delete.php.
<?
include"config.php";
if($_POST[delete]){
if(is_array($_POST['checkbox'])){
foreach ($_POST['checkbox'] as $key => $val){
$sql = mysql_query("DELETE FROM mail WHERE id='$val'");
}
echo"Deleted message $val.";
}
}
?>
I've also tried look at other PHP tutorials on multiple rows, and those have not worked for me either, so I'm guessing it's the PHP version. D:
Thanks for the help.
