to ask user before deleting a record
If user clicks ok then only delete record from database
If user clicks cancel then it should not delete record

3 Years
Discussion Span
Last Post by matrixdevuk

what database
what language
what have you attempted
mind reading is not among the skills of many of the gurus


I agree with almostbob. If this is the best question you can formulate, then I suggest the answer to your problem will be beyond you. Perhaps you should try a different hobby?


this is the easiest way to create what you want

<a onclick="return confirm('Do you want to Delete File?')" href="delete.php?id=<? echo $row['id']; ?>">Delete</a>

Edited by OsaMasw


The way I do it is I do this:
<a href="#" data-id="SOME DATABASE ID" rel="delete_modal">Delete</a> then I link that, using Javascript, to my Bootstrap modal which pops up with something like "Are you sure you want to delete this?" — which has two buttons (Yes, cancel). "Yes" would be a link to the delete page (which would change based on $(this).data('id'); or something like that, and "Cancel" would stay the same since it's only dismissing the modal.

Edited by matrixdevuk: OCD

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.