deleting guestbook messages
| From: | Mark | Date: | Thu, 20 Mar 2003 16:37:43 +0000 |
| Subject: | deleting guestbook messages | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-26520@lists.php.net to get a copy of this message | ||
hi
im having major problems deleting multiple messages from the guestbook i
have created
im new to php so any replies to this problem will have to easy for me to
understand
i have got my guestbook reading and showing entries and have added
checkboxes under each entry for the deletion process
heres what it looks like:
while ($rows = mysql_fetch_array($result)) {
$id = $rows["id"];
$firstname = $rows["first_name"];
$lastname = $rows["last_name"];
///////////////////////////////////////////////////////////////
//// ACCESS THE DATABASE'S timestamp RECORD TO SHOW DATE AND
//// TIME ENTRIES WERE MADE
//////////////////////////////////////////////////////////////
$db_date = $rows['time'];
$yr = substr($db_date, 0, 4);
$mon = substr($db_date,4,2);
$day = substr($db_date,6,2);
$hour = substr($db_date,8,2);
$min = substr($db_date,10,2);
$sec = substr($db_date,12,2);
$orgdate = date("l F dS, Y h:i A",mktime($hour,$min,$sec,$mon,$day,$year));
?>
<?///////////////////////////////////////////////////////////////?>
<? //TABLE TO SHOW THE CONTENTS OF USER_MESSAGE DATABASE TABLE ?>
<?///////////////////////////////////////////////////////////////?>
<HTML>
<HEAD>
<TITLE>Queen Vic Message Book</TITLE>
</HEAD>
<BODY>
<FORM METHOD="post" ACTION="delete.php">
<P><TABLE BORDER="1" WIDTH="600" BORDERCOLOR=#F00000>
<TR>
<b>Date/Time Posted:</b> <? echo $orgdate; ?>
</TR>
<TR>
<TD><b>Name:</b> <? echo $rows['name']; ?></TD>
<TD><b>Email:</b> <A HREF="mailto:<? echo
$rows['email']; ?>">
<? echo $rows['email']; ?></TR></TD>
<TR><TD COLSPAN="4">
<? echo $rows['message']; ?>
</TD></TR>
</TABLE>
<TD>
<b>Delete Message</b> <input type="checkbox" name="id[]"
value="$id">
</TD>
</P>
</BODY>
</HTML>
<?/////////////////////////////////////////////////////////////////?>
<?//// CLOSES LOOP CREATED FOR ADDING DATA TO TABLE?>
<?/////////////////////////////////////////////////////////////////?>
<? } ?>
i have tried to make the value of the checkbox the message id (is this
right?)
what do i need to do next
please help i have to hand this project in soon :(
thanks