javascript - how to display records selected from mysql database in jquery dialog popup in php.? -


i have display file edit button, when user click on edit button 1 window should popup data database.

i want above written functionality in application.

so please me.

here code below.

edit button code.

<a id="edit_docid" href="edit_doctor.php?id=<?php echo $tmpdocid;?>" data-target="#edit_doctor" >edit</a> 

edit functionality code.

<div id="edit_doctor" >     <?php include("db.php");      $tmpid = $_request["docid"];      $result = mysql_query("select * doctor     doctor_id = '$tmpid'") or die(mysql_error());      $row = mysql_fetch_array($result);     if (!$result)      {         die("error: data not found..");     }      $doctor_name = $row['doctor_name'];     $doctor_email = $row['doctor_email'];     $user_name = $row['username'];     $doctor_password = $row['doctor_password'];     $doctor_address = $row['doctor_address'];     $doctor_phone = $row['doctor_phone'];     $doctor_dept_name = $row['doctor_dept_name'];       if(isset($_post['update']))     {         $edit_doctor_name = $_post["edit_doctor_name"];     $edit_doctor_email = $_post["edit_doctor_email"];     $edit_user_name = $_post["edit_user_name"];     $edit_doctor_password = $_post["edit_doctor_password"];     $edit_doctor_address = mysql_real_escape_string($_post['edit_doctor_address']);     $edit_doctor_phone = $_post["edit_doctor_phone"];     $edit_doctor_dept_name = $_post["edit_doctor_dept_name"];       $query=mysql_query("update doctor                          set doctor_name = '$edit_doctor_name',                         doctor_email = '$edit_doctor_email',                         username='$edit_user_name',                         doctor_password = '$edit_doctor_password',                          doctor_address = '$edit_doctor_address',                         doctor_phone = '$edit_doctor_phone',                         doctor_dept_name = '$edit_doctor_dept_name'                         doctor_id = '$tmpid'")                         or die(mysql_error());       echo "<script>alert('record updated sucessfully...!!!!')</script>";       echo "<meta http-equiv='refresh' content='0;url=disdoctor.php'>";            }  mysql_close($con);  ?>  <div class="box">     <form id="form" name="registration" method="post" >       <table class="addtable_cls"style="margin-top:2%;margin-left: 16px;"cellspacing="1" cellpadding="10">        <tr><td style="text-align:left" ><label for="name">name<font color="red">*</font> </label></td>        <td ><input type="text" id="doctorname" name="edit_doctor_name" placeholder=" name" onblur="allletter(document.registration.fname)"  required value="<?php echo $row['doctor_name']; ?>"/>       </td><td><img src="images2/image.png" class="mastertooltip" title="eg. last first middle name"></td><td style="text-align:left"><i name="nameb"style='color:red' id='unm' ></i></td></tr>        <tr><td  style="text-align:left"> <label for="email" >email</label></td>       <td  ><input type="text" id="doctoremail" name="edit_doctor_email" onblur="myfun()" placeholder="email"  required value="<?php echo $row['doctor_email']; ?>"/>       </td><td><img src="images2/image.png" class="mastertooltip" title="enter valid email eg. abcd@example.com"></td><td style="text-align:left"><i style='color:red' id='email' ></i></td></tr>         <tr ><td style="text-align:left"> <label for="uname" >user name<font color="red">*</font></label></td>  <td ><input type="text" id="username" name="edit_user_name" onblur="allletter1(document.registration.edit_user_name)" placeholder="user name"  required value="<?php echo $user_name; ?>"/>  </td><td><img src="images2/image.png" class="mastertooltip" title="username contains a-z, a-z, 0-9, _"></td><td style="text-align:left"><i name="nameb"style='color:red' id='usernm' ></i></td></tr>         <tr><td  style="text-align:left"> <label for="password" >password <font color="red">*</font></label></td>       <td ><input type="password" id="doctorpassword" name="edit_doctor_password" placeholder=" password" onblur="passid_validation(7,20)"  value="<?php echo $row['doctor_password']; ?>"/>       </td><td></td><td style="text-align:left"><i style='color:red' id='pass' ></i></td></tr>          <tr><td></td><td ><input id="sub" type="submit" name="update" value="update doctor" onclick="return validatedoctor()"/></td></tr>    </table> </form>  </div> </div> 

try work :

use ajax getting type of functionality.

index.html :

<html> <head> <script> function getdata(doctorid)     {            var datastring = 'doctor_id=' + doctorid;           $.ajax({           type: "post",           url: "edit-doctor.php",           data: datastring,           cache: false,           success: function(html) {                   document.getelementbyid("get-data").innerhtml=html;              }           });           return false;     } </script> </head> <body> <div id="get-data"></div> <a id="edit_docid" onclick="getdata(<?php echo $tmpdocid; ?>)" href="#123" data-target="#edit_doctor" >edit</a> </body> </html> 

edit-doctor.php :

edit-doctor.php :

<div id="edit_doctor" >     <?php include("db.php");      $tmpid = $_request["doctor_id"];      $result = mysql_query("select * doctor     doctor_id = '$tmpid'") or die(mysql_error());      $row = mysql_fetch_array($result);     if (!$result)      {         die("error: data not found..");     }      $doctor_name = $row['doctor_name'];     $doctor_email = $row['doctor_email'];     $user_name = $row['username'];     $doctor_password = $row['doctor_password'];     $doctor_address = $row['doctor_address'];     $doctor_phone = $row['doctor_phone'];     $doctor_dept_name = $row['doctor_dept_name'];       if(isset($_post['update']))     {         $edit_doctor_name = $_post["edit_doctor_name"];     $edit_doctor_email = $_post["edit_doctor_email"];     $edit_user_name = $_post["edit_user_name"];     $edit_doctor_password = $_post["edit_doctor_password"];     $edit_doctor_address = mysql_real_escape_string($_post['edit_doctor_address']);     $edit_doctor_phone = $_post["edit_doctor_phone"];     $edit_doctor_dept_name = $_post["edit_doctor_dept_name"];       $query=mysql_query("update doctor                          set doctor_name = '$edit_doctor_name',                         doctor_email = '$edit_doctor_email',                         username='$edit_user_name',                         doctor_password = '$edit_doctor_password',                          doctor_address = '$edit_doctor_address',                         doctor_phone = '$edit_doctor_phone',                         doctor_dept_name = '$edit_doctor_dept_name'                         doctor_id = '$tmpid'")                         or die(mysql_error());       echo "<script>alert('record updated sucessfully...!!!!')</script>";       echo "<meta http-equiv='refresh' content='0;url=disdoctor.php'>";            }  mysql_close($con);  ?>  <div class="box">     <form id="form" name="registration" method="post" >       <table class="addtable_cls"style="margin-top:2%;margin-left: 16px;"cellspacing="1" cellpadding="10">        <tr><td style="text-align:left" ><label for="name">name<font color="red">*</font> </label></td>        <td ><input type="text" id="doctorname" name="edit_doctor_name" placeholder=" name" onblur="allletter(document.registration.fname)"  required value="<?php echo $row['doctor_name']; ?>"/>       </td><td><img src="images2/image.png" class="mastertooltip" title="eg. last first middle name"></td><td style="text-align:left"><i name="nameb"style='color:red' id='unm' ></i></td></tr>        <tr><td  style="text-align:left"> <label for="email" >email</label></td>       <td  ><input type="text" id="doctoremail" name="edit_doctor_email" onblur="myfun()" placeholder="email"  required value="<?php echo $row['doctor_email']; ?>"/>       </td><td><img src="images2/image.png" class="mastertooltip" title="enter valid email eg. abcd@example.com"></td><td style="text-align:left"><i style='color:red' id='email' ></i></td></tr>         <tr ><td style="text-align:left"> <label for="uname" >user name<font color="red">*</font></label></td>  <td ><input type="text" id="username" name="edit_user_name" onblur="allletter1(document.registration.edit_user_name)" placeholder="user name"  required value="<?php echo $user_name; ?>"/>  </td><td><img src="images2/image.png" class="mastertooltip" title="username contains a-z, a-z, 0-9, _"></td><td style="text-align:left"><i name="nameb"style='color:red' id='usernm' ></i></td></tr>         <tr><td  style="text-align:left"> <label for="password" >password <font color="red">*</font></label></td>       <td ><input type="password" id="doctorpassword" name="edit_doctor_password" placeholder=" password" onblur="passid_validation(7,20)"  value="<?php echo $row['doctor_password']; ?>"/>       </td><td></td><td style="text-align:left"><i style='color:red' id='pass' ></i></td></tr>          <tr><td></td><td ><input id="sub" type="submit" name="update" value="update doctor" onclick="return validatedoctor()"/></td></tr>    </table> </form>  </div> </div> 

Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -