update data using jquery
<p>I have a page that lists records from a database call. I want to have an 'edit' link on each row that will popup a Jquery dialog so that the row can be edited. My question is how do I pass the data from the selected row to the jquery dialog box so that it can be edited?
i have the code which open jquery popup but the textboxes are empty.</p>

<pre><code>&lt;div id="boxes">

&lt;div id="dialog2" class="window">
&lt;form method="post" action="update_books_a.php">
  &lt;input name="name" type="text" value="&lt;?php echo $ing['book_name']; ?>"/><br/>
  &lt;input name="author" type="text" value="&lt;?php echo $ing['author']; ?>"/>

    &lt;input type="hidden" name="book_id" value="&lt;?php print $ing['book_id'];?>" />
    <br/><br/>
&lt;input type="submit" value="Update" class="close"/>
&lt;/form>
&lt;/div></code></pre>

<p>myphp code is </p>

<pre><code>$select=mysql_query("select * from books where book_id='$book_id'") or die(mysql_error());
while($ing=mysql_fetch_array($select))
{
 ?>
&lt;tr>
    &lt;td>&lt;a href="#dialog2" name="modal">&lt;?php echo $ing['book_name'];?>&lt;/a>&lt;/td>
    &lt;td>&lt;?php echo $ing['author'];?>&lt;/td>&lt;/tr>
</code></pre>

<p>the jquery code is </p>

<pre><code>


$(document).ready(function() {

    //select all the a tag with name equal to modal
    $('a[name=modal]').click(function(e) {
        //Cancel the link behavior
        e.preventDefault();

        //Get the A tag
        var id = $(this).attr('href');

        //Get the screen height and width
        var maskHeight = $(document).height();
        var maskWidth = $(window).width();

        //Set heigth and width to mask to fill up the whole screen
        $('#mask').css({'width':maskWidth,'height':maskHeight});

        //transition effect
        $('#mask').fadeIn(1000);
        $('#mask').fadeTo("slow",0.8);

        //Get the window height and width
        var winH = $(window).height();
        var winW = $(window).width();

        //Set the popup window to center
        $(id).css('top',  winH/2-$(id).height()/2);
        $(id).css('left', winW/2-$(id).width()/2);

        //transition effect
        $(id).fadeIn(2000);

    });

    //if close button is clicked
    $('.window .close').click(function (e) {
        //Cancel the link behavior
        e.preventDefault();

        $('#mask').hide();
        $('.window').hide();
    });

    //if mask is clicked
    $('#mask').click(function () {
        $(this).hide();
        $('.window').hide();
    });

});



body {
font-family:verdana;
font-size:15px;
}

a {color:#333; text-decoration:none}
a:hover {color:#ccc; text-decoration:none}

#mask {
  position:absolute;
  left:0;
  top:0;
  z-index:9000;
  background-color:#000;
  display:none;
}

#boxes .window {
  position:absolute;
  left:0;
  top:0;
  width:440px;
  height:200px;
  display:none;
  z-index:9999;
  padding:20px;
}



#boxes #dialog2 {
  background:url(../images/notice.png) no-repeat 0 0 transparent;
  width:326px;
  height:229px;
  padding:50px 0 20px 25px;
}</code></pre>
