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

  • Home
  • SEARCH
  • 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 8249761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:39:21+00:00 2026-06-07T23:39:21+00:00

I have a question about jQuery UI Dialog boxes and showing dynamic content from

  • 0

I have a question about jQuery UI Dialog boxes and showing dynamic content from a database.

So I got a webapplication where I also need to make a admin module to manage all users and other information. I created a page that shows all users in a list, in every row I also made an edit button. I wanted to make it so that when you press on a users’ edit button, a dialog box opens and shows all the user information and stuff in the dialog box.

So my question is, what is the best way to do this? I was thinking about making a PHP page where I execute the MySQL Query and show that in the dialog box, but I am sure there are better ways..

EDIT: Here is the code for the page as it is right now. I added a small placeholder dialogbox that I used for testing purposes.

Javascript:

script type="text/javascript"> 
    jQuery(document).ready( function(){       
        jQuery(".edit-button").click( showDialog );

            //variable to reference window
            $myWindow = jQuery('#myDiv');

            //instantiate the dialog
            $myWindow.dialog({ height: 600,
                    width: 800,
                    modal: true,
                    position: 'center',
                    autoOpen:false,
                    title:'Bewerk therapeut',
                    overlay: { opacity: 0.5, background: 'black'}
                    });
            }

    );
//function to show dialog   
var showDialog = function() {
    $myWindow.show(); 
    //open the dialog
    $myWindow.dialog("open");
    }

var closeDialog = function() {
    $myWindow.dialog("close");
}

PHP:

<?php
//LEFT OUTER JOIN Vragen ON Vragen.bsn_nummer = Gebruikers.bsn_nummer
include_once 'classes/class.mysql.php';
$db = new Mysql();
$dbUsers = new Mysql();

$db->Query("SELECT * FROM USERS_users ORDER BY username ASC");
$db->MoveFirst();

echo "<table>";
echo "<tr><th> </th><th> </th><th>BSN Nummer</th><th>Gebruikersnaam</th>       <th>Voornaam</th><th>Achternaam</th></tr>";
while(! $db->EndOfSeek()) {
$row = $db->Row();
$dbUsers->Query("SELECT * FROM Gebruikers WHERE user_idnr = '{$row->user_idnr}'");
$rowUser = $dbUsers->Row();
echo "<tr><td><a class='del-button' href='#'><img src='afbeeldingen/edit-delete.png' /></a></td>
    <td><a class='edit-button' href='#'><img src='afbeeldingen/edit.png' /></a>  </td>
    <td>".@$rowUser->bsn_nummer."</td>      
    <td>".@$row->username."</td>
    <td>".@$rowUser->voornaam."</td>
    <td>".@$rowUser->achternaam."</td></tr>";
    }
    echo "</table>";
?>
<div id="myDiv" style="display: none">
<p>Gebruiker bewerken</p>
</div>
  • 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-07T23:39:22+00:00Added an answer on June 7, 2026 at 11:39 pm

    Nope. Sounds like you’ve got it right.

    placeholder for the popup ->

    <div id="popup"></div>
    

    jQuery ui dialog ->

    $('#popup').dialog({
      autoOpen: 'false',
      modal: 'true',
      minHeight: '300px',
      minWidth: '300px',
      buttons: {
        'Save Changes': function(){
          $.ajax({
            url: 'path/to/my/page.ext',
            type: 'POST',
            data: $(this).find('form').serialize(),
            success: function(data){
              //some logic to show that the data was updated
              //then close the window
              $(this).dialog('close');
            }
          });
        },
        'Discard & Exit' : function(){
          $(this).dialog('close');
        }
      }
    });
    

    Now that the default settings have been created, send a ajax request for the data from the php file, and update the content in the ‘popup’ div.

    $('.edit').click(function(e){
      e.preventDefault();
      $.ajax({
        url: 'path/to/my/page.ext',
        type: 'GET',
        data: //send some unique piece of data like the ID to retrieve the corresponding user information
        success: function(data){
          //construct the data however, update the HTML of the popup div 
          $('#popup').html(data);
          $('#popup').dialog('open');
        }
      });
    });
    

    in the PHP page, construct a form to be sent back ->

    <?php
      if(isset($_GET['id'])){
        //build the query, do your mysql stuff
        $query = mysql_query(sprintf("SELECT * FROM sometable WHERE id = %d", $_GET['id']));
        //construct constant objects outside of the array
    ?>
      <form>
      <?php
        while($row = mysql_fetch_array($query)){
      ?>
        <tr>
          <td>
            <input type="text" name="<?php echo $row['id']?>" value="<?php echo $row['name'] ?>" />
          </td>
        </tr>   
      <?php 
        }
      ?>
      </form>
    <?php
      }    
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a question about the dialog() function of Jquery. I wonder if instead
I have a quick question about the jQuery.validate.js plugin from bassistance. I'm using version
i have one question about jquery ajax().. I created a table grid and there
I have a question about jQuery load best practice. Imagine the following situation: $(#div).on('click',
I have a question about some functionality I'm trying to add to my jQuery
I'm working on some JQuery code and I have a question about caching selectors.
I have a simple question about the expression in jquery to select a class
I have quick question about jQuery plugins, hope somebody out there has some advice.
I'm new here and I'd like to ask a question about jQuery. I have
I have a question about usability/design. I currently am using some JQuery to hide/show

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.