Ok laserlight,
I added the rtim code for the POST array also because without it Explorer was failing and Firefox working.. Talkin about a switch 🙂
Anyhow here is my code.. It basically lists all messages from the data sheet and place a checkbox near them for deleting.. The echo $val."<br>"; is only temporary for diagnosing the immediate problem..
<?php
if (isset($_POST['value']) && is_array($_POST['value']))
{
$ck=0;
$x=0;
$xmsg = $_POST['value'];
$array = file("data/25k2525.mxg") or exit("Unable to open file!");
$cx = count($array);
$cy = count($xmsg);
foreach ($array as $key => $value)
{
$array[$key] = rtrim($value);
}
foreach ($xmsg as $key => $value2)
{
$xmsg[$key] = rtrim($value2);
}
$result = array_diff($array, $xmsg);
$fp = fopen( "data/25k2525.mxg" , "w" );
foreach($result as $val)
{
echo $val."<br>";
fwrite($fp, $val)."<br />";
}
fclose($fp);
}
$array= file("data/25k2525.mxg") or exit("No Messages Available At This Time!");
?>
<form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>" method="post">
<?
echo "<table bgcolor='#000033' border='5' width='50' cellpadding='2' cellspacing='0'>"; echo "<tr><td>";
echo "<table bgcolor='#555555' border='1' width='75' cellpadding='5' cellspacing='0'>";
echo "<tr><th align='left'>";
echo "<font face='arial' size='3' color='white'>Welcome To Your Message Box";
echo "</th></tr>";
echo "<tr><td bgcolor='#F3ECE0'>";
echo "<font color='green' face='arial'><i>Viewed</i></font> <font face='arial' size='2' color='#000000'>= Messages You Already Read.</font> <font color='#FF0000' face='arial'><i>Unread</i></font> <font face='arial' size='2' color='#000000'>= Messages You Have Not Read";
echo "</td></tr>";
echo "<tr><td nowrap>";
echo "<div style='background-color:#FFFFEC; width:555px; height:150px; overflow:auto; padding-left:8px; padding-top:5px'>";
foreach($array as $val)
{
$rdid = substr($val, 0, strpos($val, "~"));
$prdex = explode("~", $val);
$time = $prdex[0]; // message time
$date = $prdex[1]; // message date
$sender = ($prdex[2]); // messgae sender
$msg=($prdex[3]); // message contents
$viewed=($prdex[4]); // message viewed status
$a=2;
$ftime = date("g:i A", $time);
$fmsg = "Message From: ".$sender." On ".$date." At ".$ftime."<br />";
if ($viewed==1)
{
echo "<input type='checkbox' value='".$time."~".$date."~".$sender."~".$msg."~".$viewed."' name='value[]'><font color='green' size='2' face='arial'><i>Viewed</i> <a href='showmsg.php?msg=".$msg."&id=".$time."&date=".$date."&sender=".$sender."&viewed=".$viewed."' target='items' class='but1'>".$fmsg."</a>";
}
if ($viewed==0)
{
echo "<input type='checkbox' value='".$time."~".$date."~".$sender."~".$msg."~".$viewed."' name='value[]'><font color='red' size='2' face='arial'><i>Unread</i> <a href='showmsg.php?msg=".$msg."&id=".$time."&date=".$date."&sender=".$sender."&viewed=".$viewed."' target='items' class='but2'>".$fmsg."</a>";
}
}
echo "</div>";
echo "</td></tr>";
echo "<tr><td>";
echo "<input type='submit' value='Delete Selected Messages' />";
echo "</td></tr>";
echo "<tr><td align='center' bgcolor='#333333'>";
echo "<iframe name='items' width='550' height='220' src='showmsg.php' frameborder='1'>Your browser does not support inline frames or is currently configured not to display inline frames.</iframe>";
echo "</td></tr>";
echo "<tr><td height='30'>";
echo "</td></tr>";
echo "</table>";
echo "</tr></td></table>";
?>
<HTML>
<HEAD>
<style>
.but1{
color:#000000;
font-size: 12px;
text-decoration: none;
margin-top:2px;
}
.but1:link {
color:#000000;
}
.but1:visited {
color:#0066FF;
}
.but1:hover {
color:#FF0000;
}
.but1:active {
color:#0066FF;
}
.but2{
color:#0066FF;
font-size: 12px;
font-weight: bold;
text-decoration: none;
margin-top:2px;
}
.but2:link {
color:#0066FF;
}
.but2:visited {
color:#0066FF;
}
.but2:hover {
color:#FF0000;
}
.but2:active {
color:#0066FF;
}
</style>
</HEAD>
</HTML>
Hope this helps.. And Thanks for your time..