打开一个表单,单击href以更新受尊重的id数据

时间:2018-08-21 14:35:19

标签: php jquery html

在我的应用程序中,我有一个带有顺序和编辑按钮的用户记录表。当我单击编辑按钮时,我想在该行的下面打开一个新表单,并以该表单获取该用户的数据。我使用href传递该用户ID。 这是我的用户记录表代码

<div class="panel-body">
      <div class="dataTable_wrapper">
        <table class="table table-striped table-bordered table-hover" id="dataTables-example">
          <thead>
            <tr>                                           
              <th>Candidate</th>
              <th>Gender</th>
              <th>Date of Birth</th>
              <th>Gotra</th>
              <th>Action</th>
            </tr>
          </thead>
          <tbody>

            <?php
            $result=mysqli_query($conn,"select candidateid,candidatename,gender,dob,gotra from candidateinfo where clientid='$clientid' ");
            while($row = mysqli_fetch_array($result))
              {
                echo "<tr class='odd gradeX'>";
                echo "<td>" .  $row[1] . "</td>";
                echo "<td>" .  $row[2] . "</td>";
                echo "<td>" .  $row[3] . "</td>";
                echo "<td>" .  $row[4] . "</td>";
                echo "<td><a data-toggle='tooltip' data-placement='bottom' title='Order' href=reorders.php?vcandidateid=" . urlencode(base64_encode("$row[0]")) . ">Order</a>";
                echo " || <a data-toggle='tooltip' data-placement='bottom' title='Edit' href=candidateedit.php?vcandidateid=" . urlencode(base64_encode("$row[0]")) . ">Edit</a></td>";
                echo "</tr>";
              }
            ?>                      
          </tbody>
        </table>
      </div>
    </div>

我从此表中的数据库中检索数据。请帮助我。

  

jquery和表单

 <script>
 $(function() {
   $('#edit').click(function() {
       $('#update_form').show();
     });        
    });
   </script>

    <form id="update_form" class="form-horizontal" action="candidatedb.php" method="post">
    <div class="col-xs-12 col-sm-6 col-md-6 col-lg-6">
      <div class="form-group">
        <label class="hidden-xs col-sm-4 control-label" for="candidateName"><small class="color-red vlarge-text">*</small>Candidate Name</label>
        <div class="col-sm-8 xs-padding-l-r-none">
          <input type="text" id="candidatename" name="candidatename">
          <span class="help-block errmsg margin-none"></span>
        </div>
      </div>
    </div>
    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
      <div class="form-group">
          <button class="col-sm-2 btn btnDark" id="Submit" type="submit" value="" >Submit</button>
      </div>
    </div>
  </form>

0 个答案:

没有答案