Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7975171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:34:41+00:00 2026-06-04T08:34:41+00:00

Hello I’ve got another question. I am creating an administration system. I added registration

  • 0

Hello I’ve got another question. I am creating an administration system. I added registration for users and a delete function. Now I need to make a good design.

So I created a table from a MySQL DB with following infos:
ID, Username, Last Login and Delete.

This is an extraction of my php code where I print the table:

echo "<td class=\"center\">
            <a href=\"#\" class=\"delete_user\">
                <img src=\"images/delete.png\" />
                <script type=\"text/javascript\">
                    var id = \"index.php?section=user_delete&id=".$getUserID[$i]."\";
                </script>
            </a>
        </td>

As you can see I am using the ID for the delete process.

Now I want to use a jQuery modal popup to make sure that I really want to delete this person.

This is my js code:

$(".delete_user").click(function() {
    $( "#dialog_delete_user" ).dialog( "open" );
});

$( '#dialog_delete_user' ).dialog({
    autoOpen: false,
    resizable: false,
    height: 170,
    modal: true,
    buttons: {
        'ok': function() {
            alert(id);
            //document.location = id; 
            $( this ).dialog( 'close' );
        }
    }
});

As you can see I need to add a variable id to identify the person and make sure that the right person gets deleted.

I thought that the javascript only executes if i click the link. This seems to be incorrect.

So how can I define/identify each person?

The displayed table is useless cause there is no way to identify each delete button with its owner. So I have to define it right there where I create the table.

Without this jQuery modal form it would be easy. But there has to be a way to get it work. Any idea?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T08:34:42+00:00Added an answer on June 4, 2026 at 8:34 am

    Personally I would set an attribute on the link that opens the dialog something like

    <a href="bla" data-user-id="5">Click me!</a>
    

    then in the onclick event of the link that opens the dialog box I would have it set the dialog’s hidden user field to the value of $(this).data(“user-id”); If you’re not doing a form and just immediately firing an ajax request it gets even easier.

    var currentUserId;
    $(".delete_user").click(function() {
        currentUserId = $(this).data("user-id");
        $( "#dialog_delete_user" ).dialog( "open" );
    });
    
    $( '#dialog_delete_user' ).dialog({
        autoOpen: false,
        resizable: false,
        height: 170,
        modal: true,
        buttons: {
            'ok': function() {
                //document.location = "/somephpfile.php?user_id=" + currentUserId; 
                $( this ).dialog( 'close' );
    
                // ajax version
                $.ajax({
                    url : "/somephpfile.php?user_id=" + currentUserId,
                    // Other ajax related code.
                });
            }
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello everybody a probably easy question. I need a custom error handler to report
Hello I've got this query to get users by email, which is an unique
Hello does any one know that setting I need to ON for connect to
. Hello, I am trying to make a Custom Segue for my storyboard. Now
Hello guys I need to pass a string array over to a setter that
Hello ever one I want to ask a question about file opening.I want to
hello creating a custom object may be a widely published topic, but my lack
Hello and thank you in advance. I know this is total noob question, and
Hello fellow developers... just to make sure, I want to ask this question: How
Hello I need some help with a bug in Internet Explorer 9. I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.