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?!

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

<head>
    <meta charset='utf-8' />

    <title>Title</title>

    <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>
</head>

<body>

    <div class="container">

        <table class="table">

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

            <tbody>

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

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

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

            </tbody>

        </table>

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

    </div>

    <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>

</body>
</html>

Just a little mistake in the code, but that has nothing to do with the popup window, the urls are:
index.php?action=delete&id=1
index.php?action=delete&id=2
index.php?action=delete&id=3

Not
index.php?action=delete?id=1
index.php?action=delete?id=2
index.php?action=delete?id=3

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 :(

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

Be a part of the DaniWeb community

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