Problem in jQuery updating form (PHP)
<p>I want to edit field with jquery dialog box, but not able to find problem.
I have fetch data from table. And jquery dialog box only show when i click top edit button, second edit button not working.</p>

<p>Thanks</p>

<pre><code>&lt;?php 
include "db.php";
?&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;
&lt;title&gt;Registration Form&lt;/title&gt;
&lt;script type="text/javascript" language="javascript" charset="utf-8" src="jquery.js"&gt;&lt;/script&gt;


&lt;script type="text/javascript" language="javascript" charset="utf-8" src="jquery.form.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" language="javascript" charset="utf-8" src="jquery.blockUI.js"&gt;&lt;/script&gt;
&lt;style type="text/css"&gt;
#overview h2 { border: 1px dashed gray; padding: 10px; background-color: #ffc;
    color: black; font-size: medium; margin: 10px 0;
}
#footer { font-family: sans-serif; color: #888 }
#domMessage { padding: 10px; }
div.blockMe { padding: 30px; margin: 30px; border: 10px solid #ccc; background-color: #ffd }
#question { background-color: #ffc; padding: 10px; }
#question input { width: 4em }

#demoTable { border: 1px solid #ddd }
#demoTable tr.odd { background-color: #efe }
#demoTable th { padding: 15px; background-color: #ffa }
#demoTable td { padding: 15px; vertical-align: top }
#tallContent h1 { margin: 15px }

#twitter { float:right; right: 20px; margin: 0 15px 15px 15px }
#twitter a { text-decoration: none; font-family: arial }
#twitter img { border: none; float: left }
&lt;/style&gt;

&lt;script&gt;
$(document).ready(function() {
    $('#demo1').click(function() {
        $.blockUI({ message: $('#loginForm') });

    });
    $('#close').click(function() {
        $.unblockUI();


    });
});

&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;fieldset&gt;
 &lt;legend&gt;&lt;strong&gt;Labs:&lt;/strong&gt;&lt;/legend&gt;&lt;/fieldset&gt;
&lt;table align="center" width="80%"&gt; 
&lt;tr&gt;&lt;td align="right" &gt;&lt;a href="pt.php"&gt;&lt;button&gt;+&lt;/button&gt;&lt;/a&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;table align="center"  border="1" cellpadding="5" cellspacing="0" width="80%" bordercolor="#CCCCCC"&gt;


    &lt;tr style="background-image:url(img/tr.png);"&gt;
    &lt;th&gt;ID:&lt;/th&gt;
    &lt;th&gt;Date of Report:&lt;/th&gt;
    &lt;th&gt;Name:&lt;/th&gt;
    &lt;th&gt;Action&lt;/th&gt;
    &lt;/tr&gt;

&lt;?php
$str="select * from `labs` order by `id` DESC ";
$rs=mysql_query($str);
?&gt;
&lt;?php
while($row=mysql_fetch_array($rs))
{
?&gt;
&lt;tr&gt;
&lt;td&gt;&lt;?php echo $row['id'];?&gt; &lt;/td&gt;
&lt;td&gt;&lt;?php echo $row['date'];?&gt;&lt;/td&gt;
&lt;td&gt;&lt;?php echo $row['name'];?&gt; &lt;/td&gt;
&lt;td align="center"&gt;&lt;button id="demo1"&gt;Edit&lt;/button&gt;
&lt;a href="delte.php?id=&lt;?php echo $row['id'];?&gt;"&gt;&lt;button&gt;X&lt;/button&gt;&lt;/a&gt;&lt;/td&gt;


&lt;/tr&gt;
&lt;?php
}
?&gt;
     &lt;div id="loginForm" style="display:none;width:300px;height:200px;background-color:#b0c4de;margin:20px;padding:30px;"&gt;

            &lt;p&gt;&lt;label&gt;Date of Report:&lt;/label&gt;&lt;input type="text" name="demo1" /&gt;&lt;/p&gt;
            &lt;p&gt;&lt;label&gt;Name:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/label&gt;&lt;input type="text" name="demo1" /&gt;&lt;/p&gt;
            &lt;a href="#" id="close"&gt;Update&lt;/a&gt;
        &lt;/div&gt;

&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p><em><strong>edit.php</em></strong></p>

<pre><code>&lt;?php 
include "db.php";
$action=$_POST['action'];
$id=$_REQUEST['id'];

$str="select * from `labs` where id='$id'";

$rs=mysql_query($str);
$row=mysql_fetch_array($rs);

?&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;
&lt;title&gt;Labs&lt;/title&gt;

&lt;/head&gt;

&lt;body&gt;
&lt;table align="center" width="75%" border="0"&gt;
&lt;form name="frm" method="post" action="&lt;?php $_SERVER['PHP_SELF'] ?&gt;" enctype="multipart/form-data"&gt;
  &lt;fieldset&gt;
    &lt;legend&gt;Labs:&lt;/legend&gt;
    &lt;tr&gt;&lt;td&gt;&lt;strong&gt;Date of Report:&lt;/strong&gt;&lt;/td&gt;&lt;td &gt;&lt;input type="text" size="10" name="date" value="&lt;?php echo $row['date']?&gt;" /&gt;dd/mm/yyyy &lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;
    &lt;tr&gt;&lt;td&gt;&lt;strong&gt;Name:&lt;/strong&gt;&lt;/td&gt;&lt;td &gt; &lt;input type="text"  size="30" name="name" value="&lt;?php echo $row['name']?&gt;" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;

    &lt;tr&gt;&lt;td colspan="2" align="center"&gt;&lt;input type="submit" name="insert" value="Submit" /&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;/fieldset&gt;
  &lt;tr&gt;&lt;td colspan="2"&gt;&lt;font color="#FF0000"&gt;&lt;?php $msg=$_REQUEST['msg'];
  echo $msg;
  ?&gt;&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;/form&gt;
&lt;/table&gt;


&lt;/body&gt;
&lt;/html&gt;
&lt;?php 
if(isset($_POST['insert']));
{


$date=$_POST['date'];
$name=$_POST['name'];
if(!$name==" ")
{
exit(0);
}
$sql="UPDATE `labs` SET  `date` =  '$date',
`name` =  '$name' WHERE  `labs`.`id` =$id LIMIT 1 ";

mysql_query($sql);

}
?&gt;
</code></pre>
