Confirmation dialog box using PHP/HTML


#1

Hi everyone,
I have code where a MySQL table’s row is deleted.
Before deleting I’d like a user’s confirmation whereby dialog box.
Can anyone show me how to do that?
Thanks


#2

It would make sense to use javascript

example using sweet alert
first set up event listeners for the delete button click (element lookup have to be changed according to your schema)
then show a confirmation box, on confirm send an ajax request to your delete script (/api/delete.php has to be made to delete the row of the submitted id)
then show a success box
https://jsfiddle.net/1xbn8m46/

[php]

  • Item 1 -
  • Item 2 -
  • Item 3 -
[/php]

#3

Thank you JimL !