A few things, some of which has already been mentioned:
1) Instead of deleting either
a) Have a column that sets the record's "is deleted / expired etc." status
b) Move the data to a {tablename}_deleted table. This could be useful if it's a table with a lot of rows that is heavily accessed / indexed etc by your application. No sense having expired/old/deleted data in a table.
2) Keep an audit trail of the delete action. Store in the db:
* user id of the user who "deleted" the content
* date content was "deleted"
Sometimes you need to find out "Who in the hell deleted such and such!?"
3) From a UI delete confirmation POV you could do either or (you should probably do both in case JavaScript is disabled):
a) I find a JavaScript confirm() to be useful. Catch the form submit:
PHP Code:
if ( confirm( "Do you want to delete this?" ) )
{
// Submit form
}
b) In case JavaScript has been disabled, send the the delete to an intermediate confirmation page similar to the above. You could have an <a> link or a button that submits the delete confirmation.
Bookmarks