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

Recommended Answers

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

Jump to Post

All 4 Replies

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

Member Avatar

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>

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.