Hello to everyone,
I am trying to create a .php file that delete database rows with a popup window that confirmates the action.
I know that are a dozen of examples, but after meany tries do to that I was not able do that, because I haven't knowledge about javacript. Also posted something before here on daniweb, but with no response.
After some researches I found this(link) example source code github link.

Here is a simplified code that I have managed to "create", but I only get the popup windows when I click on delete action of Item I. Could someone help me with this?!

    //Here goes the delete procedure, but I have no problem here
<!DOCTYPE html>

    <meta charset='utf-8' />


    <link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css" rel="stylesheet">
    <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
    <script src="../jquery.confirm.js"></script>


    <div class="container">

        <table class="table">

                    <th class="col-lg-3">#</th>
                    <th class="col-lg-1">Name</th>
                    <th class="col-lg-8">Action</th>


                    <td>Item 1</td>
                    <td><a id="simpleConfirm" href="index.php?action=delete?id=1" class="btn btn-primary">Delete</a></td>

                    <td>Item 2</td>
                    <td><a id="simpleConfirm" href="index.php?action=delete?id=2" class="btn btn-primary">Delete</a></td>

                    <td>Item 3</td>
                    <td><a id="simpleConfirm" href="index.php?action=delete?id=3" class="btn btn-primary">Delete</a></td>



                title:"Delete confirmation",
                text: "This is very dangerous, you shouldn't do it! Are you really really sure?",
                confirm: function(button) {
                    alert("You just confirmed.");
                cancel: function(button) {
                    alert("You aborted the operation.");
                confirmButton: "Yes I am",
                cancelButton: "No"
            $("#manualTrigger").click(function() {
                    text: "This is a confirmation dialog manually triggered! Please confirm:",
                    confirm: function() {
                        alert("You just confirmed.");
                    cancel: function() {
                        alert("You cancelled.");


    <script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.2/js/bootstrap.min.js"></script>
    <script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script>

3 Years
Discussion Span
Last Post by almostbob

Just a little mistake in the code, but that has nothing to do with the popup window, the urls are:



this is how i would do it
your code:

<td>Item 1</td>
                    <td><a id="simpleConfirm" href="index.php?action=delete?id=1" class="btn btn-primary">Delete</a></td>

amended code

<td>Item 1</td>
                    <td><a id="simpleConfirm" href="index.php?action=delete?id=1" onclick="return confirm('Do you really want to DELETE your RECORD?');" class="btn btn-primary">Delete</a></td>

use the "onclick" function in the table
i added onclick="return confirm('Do you really want to DELETE your RECORD?');" to your code


Sammys, thank you for the reply, but this is not a solution.
This is a ugly way to do that, becase modern browsers are blocking alert and confirm dialogs if you use often in one page :(

Edited by developer707


delete is not always a good idea, for audit trails,
let delete be 'change someflag to exclude this record from user searches, let admin still see it'
may be a moot point, the delete code already error proofed

my delete function inserts sql NOW in a deleted column, as a record of when the user wanted this record deleted, admin reports select where deleted not nul for confirmation, user id for every transaction is recorded

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.