So, I have a user driven website. Users can post whatever they want, even a picture. Now, I use PHP to store the posts in my database table and PHP and MySQL to retrieve display the posts on each user’s profile. Now, I want to give the user the ability to delete a post they upload, and I want to use $_POST to do it, not $_GET. I already know how to do it with $_GET. How could I use $_POST? Could I just have a hidden form field next to each user post and have a hidden field holding the post_id and when the user hits the “delete post” submit button it calls the delete post.php script? Is that a good way to do it, through a hidden form field?
Share
You would just set your
form‘smethodequal topost, then, have some kind ofinputof typehidden, with avalueof the id to delete.Then, in PHP, access that with
$_POSTrather than$_GET.DO make sure to validate the deletion ID, so user’s don’t just edit the HTML with FireBug, and so on.