7.7. Confirming Your Choice to Delete an Entry

Clicking the delete link now causes the return value of confirmDelete() to be displayed; your next step is to define confirmDelete(). This function accepts two arguments: a database object and the URL of the entry to be deleted.

The function uses the entry's URL to load the entry's information, which pops up and displays a form to the user that asks whether a given entry should be deleted. This form contains hidden inputs that store the action you want carried out by the form (delete), and the URL of the entry that will be deleted if the user confirms that he wants to delete the entry.

Add the following code to functions.inc.php to declare the function confirmDelete():

function confirmDelete($db, ...

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.