Hallo allemaal,

Ik krijg deze foutmelding:

Warning: Invalid argument supplied for foreach() in C:\AppServ\www\Thomaz.eu.tc\pberichten.php on line 30
Berichten succesvol verwijdert, u wordt over 5 sec. doorgestuurd.

En ik had nog een vraag, hoe je dit plaatje goed kan uitlijnen, net zoals de rest van de plaatjes. (Dat plaatje van verwijderen.)

En nog een fout in het script, als je de eerste selectbox selecteert, selecteert die de rest niet, weet iemand ook daar de fout van?

Hier mijn script:

<head> 
<script language="JavaScript"> 

var checkflag = "false"; 
function check(field) { 
if (checkflag == "false") { 
for (i = 0; i < field.length; i++) { 
field[i].checked = true;} 
checkflag = "true"; 
return "Uncheck All"; } 
else { 
for (i = 0; i < field.length; i++) { 
field[i].checked = false; } 
checkflag = "false"; 
return "Check All"; } 
} 

</script> 
</head>

<?php

include ("config.php");
include ("global.php");

if (!isset($inuit))
{
header("Location: index.php?pagina=fout");
exit;
}

if (!isset($_SESSION['login']))
{
echo '<table width="99%" border="0" align="center" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="Tekst">Je moet ingelogd zijn om je privéberichten te bekijken!</td>
	  </tr>
	</table>';
	
		echo '<table width="524" border="0" cellspacing="0" cellpadding="0">
				   <tr>
					 <td height="3" background="png/content_onder.PNG"></td>
				   </tr>
				 </table>';
}
else
{

if ($_SERVER['REQUEST_METHOD'] == "POST"){
    foreach ($_POST['delete'] as $value) {
     $query = "DELETE FROM pb WHERE id='".$value."'";     
     mysql_query($query) or die (mysql_error()); 

    }
echo "Berichten succesvol verwijdert, u wordt over 5 sec. doorgestuurd. <META HTTP-EQUIV='refresh' CONTENT='5; URL=?pagina=pberichten'> ";   
}
else
{

	if (empty($_GET['id']))
	{
?>
<link href="newstyle.css" rel="stylesheet" type="text/css" />

<table width="99%" height="2" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td></td>
  </tr>
</table>
<table width="524" border="0" cellpadding="0" cellspacing="0" background="png/content.PNG">
  <tr>
    <td><table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td align="left" valign="middle"><form id="form1" name="form1" method="post" action="">
              <img src="png/pb/Pb_nieuw.png" width="121" height="26" />
              <img src="png/pb/Pb_inbox.png" width="75" height="26" />
              <img src="png/pb/Pb_Outbox.png" width="75" height="26" />
            <img src="png/pb/Pb_blokkeren.png" width="93" height="26" /> 
            <input type="submit" name="verwijderen" class="msgdel" value=" " onclick="return confirm('Weet je zeker dat je de geselecteerde berichten wilt verwijderen?');" />
        </form></td>
      </tr>
    </table>
	<table width="99%" height="2" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td></td>
  </tr>
</table>
	</td>
  </tr>
</table>
<table width="524" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="2" height="2" background="png/pb/pb_hoek_links1.PNG"></td>
	<td width="20" background="png/pb/pb_boven.PNG"></td>
	<td width="1" background="png/pb/punt.PNG"></td>
	<td width="119" background="png/pb/pb_boven.PNG"></td>
	<td width="1" background="png/pb/punt.PNG"></td>
	<td width="258" background="png/pb/pb_boven.PNG"></td>
	<td width="1" background="png/pb/punt.PNG"></td>
    <td width="120" background="png/pb/pb_boven.PNG"></td>
    <td width="2" height="2" background="png/pb/pb_hoek_rechts1.PNG"></td>
  </tr>
</table>
<table width="524" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="2" background="png/pb/pb_links.PNG"></td>
    <td width="20" align="center" background="png/pb/pb_midden.PNG" class="Tekst"><label>
     <input type="checkbox" value="Check All" onClick="this.value=check(this.form.delete[])">
    </label></td>
    <td width="1" align="center" background="png/pb/punt.png" class="Tekst"></td>
    <td width="119" align="center" background="png/pb/pb_midden.PNG" class="Tekst">Verzonden door:</td>
    <td width="1" align="center" background="png/pb/punt.png" class="Tekst"></td>
    <td width="258" align="center" background="png/pb/pb_midden.PNG" class="Tekst">Onderwerp:</td>
    <td width="1" align="center" background="png/pb/punt.png" class="Tekst"></td>
    <td width="120" align="center" background="png/pb/pb_midden.PNG" class="Tekst">Datum:</td>
    <td width="2" background="png/pb/pb_rechts.PNG"></td>
  </tr>
</table>
<table width="524" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="2" height="2" background="png/pb/pb_hoek_links2.PNG"></td>
	<td width="20" background="png/pb/pb_onder.PNG"></td>
	<td width="1" background="png/pb/punt.PNG"></td>
	<td width="119" background="png/pb/pb_onder.PNG"></td>
	<td width="1" background="png/pb/punt.PNG"></td>
	<td width="258" background="png/pb/pb_onder.PNG"></td>
	<td width="1" background="png/pb/punt.PNG"></td>
    <td width="120" background="png/pb/pb_onder.PNG"></td>
    <td width="2" height="2" background="png/pb/pb_hoek_rechts2.PNG"></td>
  </tr>
</table>

<?php
		$query = "SELECT * FROM pb WHERE user='".$_SESSION['naam']."'";  
		$result=mysql_query($query) or die (mysql_error());  
		$mnr = mysql_num_rows($result);
		while ($sql = mysql_fetch_assoc($result)) 
		{ 
			if ($sql['1read'] == "ja") 
			{
?>
<table width="524" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="2" background="png/pb/pb_links.PNG"></td>
    <td width="20" align="center" background="png/pb/pb_midden.PNG" class="Tekst"><label>
       <input type="checkbox" name="delete[]" value="<?php echo $sql['id']; ?>" />
    </label></td>
    <td width="1" align="center" background="png/pb/punt.png" class="Tekst"></td>
    <td width="119" align="center" background="png/pb/pb_midden.PNG" class="Tekst"><?php echo ucfirst($sql['from']); ?></td>
    <td width="1" align="center" background="png/pb/punt.png" class="Tekst"></td>
    <td width="258" align="center" background="png/pb/pb_midden.PNG" onclick="parent.location='index.php?pagina=pberichten&id=<?php echo $sql['id']; ?>'"  onmouseover= "this.style.cursor='pointer'" class="Tekst"><?php echo $sql['onderwerp']; ?></td>
    <td width="1" align="center" background="png/pb/punt.png" class="Tekst"></td>
    <td width="120" align="center" background="png/pb/pb_midden.PNG" class="Tekst"><?php echo $sql['datum']; ?></td>
    <td width="2" background="png/pb/pb_rechts.PNG"></td>
  </tr>
</table>
<table width="524" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="2" height="2" background="png/pb/pb_hoek_links2.PNG"></td>
	<td width="20" background="png/pb/pb_onder.PNG"></td>
	<td width="1" background="png/pb/punt.PNG"></td>
	<td width="119" background="png/pb/pb_onder.PNG"></td>
	<td width="1" background="png/pb/punt.PNG"></td>
	<td width="258" background="png/pb/pb_onder.PNG"></td>
	<td width="1" background="png/pb/punt.PNG"></td>
    <td width="120" background="png/pb/pb_onder.PNG"></td>
    <td width="2" height="2" background="png/pb/pb_hoek_rechts2.PNG"></td>
  </tr>
</table>

<?php

			}
			else
			{
			?>
			<table width="524" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="2" background="png/pb/pb_links_g.PNG"></td>
    <td width="20" align="center" background="png/pb/pb_midden_g.PNG" class="Tekst"><label>
       <input type="checkbox" name="delete[]" value="<?php echo $sql['id']; ?>" />
    </label></td>
    <td width="1" align="center" background="png/pb/punt.png" class="Tekst"></td>
    <td width="119" align="center" background="png/pb/pb_midden_g.PNG" class="Tekst"><?php echo ucfirst($sql['from']); ?></td>
    <td width="1" align="center" background="png/pb/punt.png" class="Tekst"></td>
    <td width="258" align="center" background="png/pb/pb_midden_g.PNG" onclick="parent.location='index.php?pagina=pberichten&id=<?php echo $sql['id']; ?>'"  onmouseover= "this.style.cursor='pointer'" class="Tekst"><?php echo $sql['onderwerp']; ?></td>
    <td width="1" align="center" background="png/pb/punt.png" class="Tekst"></td>
    <td width="120" align="center" background="png/pb/pb_midden_g.PNG" class="Tekst"><?php echo $sql['datum']; ?></td>
    <td width="2" background="png/pb/pb_rechts_g.PNG"></td>
  </tr>
</table>
<table width="524" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="2" height="2" background="png/pb/pb_hoek_links2g.PNG"></td>
	<td width="20" background="png/pb/pb_onder_g.PNG"></td>
	<td width="1" background="png/pb/punt.PNG"></td>
	<td width="119" background="png/pb/pb_onder_g.PNG"></td>
	<td width="1" background="png/pb/punt.PNG"></td>
	<td width="258" background="png/pb/pb_onder_g.PNG"></td>
	<td width="1" background="png/pb/punt.PNG"></td>
    <td width="120" background="png/pb/pb_onder_g.PNG"></td>
    <td width="2" height="2" background="png/pb/pb_hoek_rechts2g.PNG"></td>
  </tr>
</table>
			
			
			
			<?php
			}
		}
	}
	else
	{
		
	$query = "SELECT * FROM pb WHERE user='".$_SESSION['naam']."' && id='".htmlspecialchars($_GET['id'])."'";  
	$result=mysql_query($query) or die (mysql_error());  
	$mnr = mysql_num_rows($result);
	$sql = mysql_fetch_assoc($result);
		
		if ($mnr == "0")
		{
			echo '<table width="99%" border="0" align="center" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="Tekst">Dit bericht bestaat niet (meer) !</td>
	  </tr>
	</table>';
	
		echo '<table width="524" border="0" cellspacing="0" cellpadding="0">
				   <tr>
					 <td height="3" background="png/content_onder.PNG"></td>
				   </tr>
				 </table>';
		
		}
		else
		{
		echo '<table width="99%" border="0" align="center" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="Tekst">';
			
		echo $sql['bericht'];
		
		echo '</td>
	  </tr>
	</table>';
		
		echo '<table width="524" border="0" cellspacing="0" cellpadding="0">
				   <tr>
					 <td height="3" background="png/content_onder.PNG"></td>
				   </tr>
				 </table>';
		}
	}	
}
}

?>


Mvg. Thomas

Reageren