Delete all PM's
Posted: Fri Aug 13, 2004 1:03 pm
I have a checkbox for each Private Message on a page. Their on a form. How would i make it so that it gets all of the name of all of the checkboxes, which the names of would be the ID of the PM's in the database, and then delete that row from the table?
Here is the code that makes the checkbox for each provate message:
Here is the code that makes the checkbox for each provate message:
Code: Select all
echo "
<form method="POST" action="index.php?action=msgcsrd">
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
<tr>
<td width="20%" align="center">From:</td>
<td width="20%" align="center">Subject:</td>
<td width="20%" align="center">Date:</td>
</tr>
";
$link = mysql_connect("localhost", "root", "")
or die("Could not connect");
mysql_select_db("stormst_sspp")
or exit("Could not select database");
$query = mysql_query("SELECT * FROM pm WHERE toid='$suser' ORDER BY `ID` DESC") or die(mysql_error());
$pmc='0';
while($row = mysql_fetch_assoc($query)) {
$pmc++;
$fromid=$row['fromid'];
$subject=$row['subject'];
$date=$row['date'];
$id=$row['id'];
echo "
<tr>
<td width="20%">
<p align="center">
<input type="checkbox" name="C$id" value="ON" style="float: left">$fromid</td>
<td width="20%">
<p align="center"><a href="index.php?action=msgcrf&id=$id">$subject</a></td>
<td width="20%">
<p align="center">$date</td>
</tr>";
}
echo "
</table>
";
if ($pmc=='0') {
Echo "You have no private messages.";
} else {
echo "
<input type="submit" value="Delete Selected Items" name="B1">";
}
echo " </form>";
mysql_close($link);