internal mail
Posted: Sat Dec 05, 2009 5:43 pm
im trying to create a internal mail message system.
though I keep running into problems can anyone point me in direction of a good tutorial or help me with mine?
so far i got my database.
a page that displays list of messages in brief
a page that displays list of messages sent in brief
now i want to be able to delete messages
This is code im using to display messages. i also added a form as i thought i need some kind of checkbox and somedata
to be passed then on the maildelete.php im struggling to figure out what i should be checking for and my query
though I keep running into problems can anyone point me in direction of a good tutorial or help me with mine?
so far i got my database.
a page that displays list of messages in brief
a page that displays list of messages sent in brief
now i want to be able to delete messages
This is code im using to display messages. i also added a form as i thought i need some kind of checkbox and somedata
to be passed then on the maildelete.php im struggling to figure out what i should be checking for and my query
Code: Select all
<?php
include_once 'Connect.php'; //This starts session, connect to database and calls any functions needed
$usernameid = $_SESSION['id'];
$query = ("SELECT * FROM mail WHERE messageto = '$usernameid' ");
$result = mysql_query($query) or die ('failed query.');
$exist = mysql_num_rows($result);
if($exist=='0')
{
echo"You have no mail";
}
else
{ echo "<form action='maildelete.php' method='POST' name='delete'>";
echo "<table border='1' cellspacing='1' cellpadding='1'>";
echo "<tr><td></td><td>FROM</td><td>SUBJECT</td></tr>";
while ($row = mysql_fetch_assoc($result))
{
$messagefrom = $row["messagefrom"];
$messagedate = $row["date"];
$subjecttitle = $row["subjecttitle"];
$message = $row["message"];
echo "<tr><td><input name='checkdelete' type='checkbox' value='1'></td>";
echo "<td>$messagefrom</td>";
echo "<td><div align='left'>$subjecttitle</div>";
echo "$message - only want it to display 1st 50 characters...<br>";
echo "<div align='right'>$messagedate</div></td></tr>";
}
echo "<tr><td><input type='submit' value='DELETE' name='submit'></td></tr></table></form>";
}
?>