I've been working on a small admin panel that should allot me to delete multiple items useing check boxes. The problem is once it hits my foreach() statment it craps out and gives me this warning
Warning: Invalid argument supplied for foreach() in C:\adminpanel\administration.php on line 66
I've tried about 5 or 6 different ways of doing it but they all require a loop and I always end up getting the same type of warning. Heres my current code, can someone please explain how I should fix this. Much thanks.
html part:
<b>Del:</b><input type='checkbox' name='checkrem[]' value='<? echo $row['id']; ?>' /><a href='?crem'>Del</a>
php part:
elseif(isset($_GET['crem']) && (isset($_SESSION['news_login']))) {
$rem = $_REQUEST['checkrem[]']; // $checkrem in the array
// print_r($rem);
foreach ($rem as $gone) {
mysql_query("DELETE FROM `headlines` WHERE `id` = '".mysql_real_escape_string($_GET['id'])."' LIMIT 1") or die ("Fail to remove");}
}