10.7. Deleting Comments

Your last step is to provide site administrators with the ability to remove comments from entries. You've already created the link to delete comments; now you need to tell your application what to do when the link is clicked.

The link you've built directs you to update.inc.php. It also passes two values using the GET method: an action, set to comment_delete; and an id, set to the value of the comment you created the link for.

To avoid accidental comment deletion, you can use a two-step process to delete comments. After clicking the link, the user receives a confirmation form generated by the confirmDelete() method (which you'll write in a moment). The form asks the user to confirm his decision to delete the comment. If ...

Get PHP for Absolute Beginners now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.