Greetings everyone!
Im having some problems with my script(Warning: Invalid argument supplied for foreach()). Im trying to update posts thats been checked, heres what i got together sofar.
Hope you can help me out here, been searching the internet for hours.
if (isset($_POST["del"])) {
if($HTTP_GET_VARS["event"]=delete)
{
if($_GET['mail']==inbox)
{
$s_del = del_sender;
}
else
{
$s_del = del_modtager;
}
foreach($_POST["del_selected"] as $id)
{
mysql_query("UPDATE eo_mail SET $s_del = '1' WHERE id='$id'");
}
}
}
?>
<form name="update" method="post"><input type='submit' name='del' value='Delete Selected'>
<?php
while ($inbox = mysql_fetch_assoc($get_inbox))
{
$bgcolor1 = $bgcolor;
if($bgcolor1==2)
{
$bgcolor1=0;
}
switch ($bgcolor1) {
case "0":
$bgcol = EEEEEE;
break;
case "1":
$bgcol = FAF8FB;
break;
default:
$bgcol = EEEEEE;
break;
}
$bgcolor = $bgcolor1 + 1;
$inbox_sql = $inbox['sender'];
$get_users = mysql_query("SELECT * FROM eo_users WHERE id=$inbox_sql") or die(mysql_error());
$users = mysql_fetch_assoc($get_users);
If ($inbox['read']==0)
{
echo "<tr><td><input type='checkbox' name='del_selected[]' value='".$inbox['id']."'></td><td style=background-color:#".$bgcol."><b> ".$users['nickname']."</b></td><td style=background-color:#".$bgcol."><b> ".$inbox['message']."</b></td><td style=background-color:#".$bgcol."><b> ".date("d/m/Y - H:i",$inbox['dato'])."</b></td></tr>";
}
else
{
echo "<tr><td><input type='checkbox' name='del_selected[]' value='".$inbox['id']."'></td><td style=background-color:#".$bgcol."> ".$users['nickname']."</td><td style=background-color:#".$bgcol."> ".$inbox['message']."</td><td style=background-color:#".$bgcol."> ".date("d/m/Y - H:i",$inbox['dato'])."</td></tr>";
}
}
?>