Hiho, I really need some help with this…
I have my index page where administrators can add new posts, but I also wish to give them the option of deleting or making changes to their posts.
I’m using two images as input elements and not sure how it works with the form… anyway, each post has a unique ID, just not sure how to connect it with the form. Essentially the images of the input element are only visible if the administrator is logged in, which means that guests won’t be able to see them.
I have the form inside the while loop… this might be the thing that’s confusing me???
The code below displays new posts and contains the form.
[php]
<div id="post">
<form action="" method="POST">
<input type="image" name="delete" src="images/deletepost.png" class="" title="Delete Post">
<input type="image" name="edit" src="images/editpost.png" class="" title="Edit Post">
</form>
</div>
<?php } ?>
<?php echo nl2br($body);
}
?>
[/php]
Not sure how I can get the wanted post ID
[php]
if(empty($_POST) === false) {
$postID = $_POST['delete'];
mysql_query("DELETE FROM `news` WHERE `id` = '$postID'");
}
[/php]
Any help is appreciated.