Delete from Checklist
Posted: Thu Apr 08, 2004 3:47 am
Heres what i have at the moment:
Problem is.. well when i select a checkbox (list box) it doesnt delete the announcement. Please tell me where im going wrong and sorry about it being a mess.. thats how i like it
Code: Select all
// Delete Announcement
if($_GET['dfga'] == "announcedelete") {
echo("<form action="admin.php?dfga=announcedeleted" method="post">
<tr valign="top" bgcolor=#104C68>
<td width="100%" colspan="3"><font face="verdana" size="1"><hr></font></td>
</tr>
<tr bgcolor=#104C68>
<td width="100%" colspan="2" bgcolor="#104C68"><font face="verdana" size="2"><b>Delete A Announcement:</b></font></td>
</tr>
<tr bgcolor=#104C68>
<td width="100%"><font face="verdana" size="2">");
$query = "SELECT * FROM dfga_ann";
$result = mysql_query($query) or die(mysql_error());
while($r=mysql_fetch_array($result))
{
$id=$r["id"];
$msg=$r["msg"];
echo "<input type=radio value=$id name=ann> $msg<hr>";
}
echo("</font></td>
</tr>
<tr bgcolor=#104C68>
<td width="100%" colspan="2"><center><input type="submit" value="Delete Announcement"></center></td>
</tr>
</table>
</form>
</center>
</body>
</html>");
}
if($_GET['dfga'] == "announcedeleted") {
// #######################################################################################
// # Delete's Announcement In 'ann' Table
// #######################################################################################
$id=$r["id"];
$query = "DELETE FROM dfga_ann WHERE id = '$id'";
// DELETE * FROM dfga_ann WHERE id='$id'
$result = mysql_query($query) or die(mysql_error());
if($result)
echo "<meta http-equiv="Refresh" content="2; URL=admin.php?dfga=announcedelete">
<tr valign="top" bgcolor=#104C68>
<td width="100%" colspan="3"><font face="verdana" size="1"><hr></font></td>
</tr>
<tr bgcolor=#104C68>
<td width="100%" colspan="2" bgcolor="#104C68"><font face="verdana" size="2"><b>Announcement Deleted!</b> - Please wait...</font></td>
</tr>";
}Problem is.. well when i select a checkbox (list box) it doesnt delete the announcement. Please tell me where im going wrong and sorry about it being a mess.. thats how i like it