I am trying to find a way to dynamically generate a delete checkbox beside each condolence message that I receive for a deceased person. Here is the codee that I have been using, but it only deletes all the condolences for the person selected. I am trying to individually delete each record, or multiple delete them.
Any help with this will be most greatly appreciated.
// display individual record
if ($id) {
$result = mysql_query("SELECT * FROM condolenceone WHERE id=$id",$db);
printf("<center><i><font size=3>Online Condolences</I></center><font size=5><center><b>%s\n</center></b></font><center><hr size=4 width=300 color=black></center><br>", $Fullname);
If($myrow = mysql_fetch_array($result)){
do{
printf("<table width=500 align=center><tr><td>%s</td></tr><tr><td> </td></tr><tr><td><font size=2><i>From</i> <b>%s</b><i> at</i> (%s)</td></tr><tr><td><font size=2><i>Location:</i> %s<br></font></td></tr><tr><td><input type=checkbox name=delete value=$delete>Delete This Condolence<hr></hr></td></tr></table>\n", nl2br($myrow["cond_message"]), $myrow["cond_name"], $myrow["cond_email"], $myrow["cond_city"]);
if ($delete="YES") { echo "CHECKED"; }
}
while ($myrow = mysql_fetch_array($result));
echo "<form action=deletetwo.php?id=$id& method=post>";
echo "<center><input type=submit value=\"Remove Condolences\"><center></form><br>";
} else {
// no records to display
echo "<center><font size=4 color=red><b>No Condolences Are Currently Available.</center></b></font>";
}
} else {
echo "<p align=center><font size=6 color=green><b>Condolence System</b></font></p>";
// show employee list
$result = mysql_query("SELECT * FROM employees ORDER BY date DESC LIMIT 7",$db);
if ($myrow = mysql_fetch_array($result)) {
// display list if there are records to display
echo "<CENTER><TABLE CELLPADDING=5 CELLSPACING=0 WIDTH=500><TR BGCOLOR=#000000><TD ALIGN=left WIDTH=150><B><FONT FACE=Garamond SIZE=3 COLOR=#FFFFFF>Last Name</FONT></B></TD><TD ALIGN=CENTER WIDTH=150><B><FONT FACE=Garamond SIZE=3 COLOR=#FFFFFF>Full Name</FONT></B></TD><TD ALIGN=center WIDTH=150><B><FONT FACE=Garamond SIZE=3 COLOR=#FFFFFF>Date</FONT></B></TD></TR><br>";
do {
printf("<tr><td align=left>%s</td><td align=center><a href=\"%s?id=%s&Fullname=%s\">%s</a></td><td align=center>%s</td></tr>\n", $myrow["last"], $PHP_SELF, $myrow["id"], $myrow["Fullname"], $myrow["Fullname"], $myrow['date']);
} while ($myrow = mysql_fetch_array($result));
} else {
// no records to display
echo "Sorry, no records were found!";
}
}
?>