title: Choose employee name and his/her ID will show in the textbox in PHP
body: <p>I want to show the ID of Francis when I click it. Also in the database there is a list of employee name and ID. So if I click Francis or Ivann. In the textbox (the arrow) it will show his/her ID specified only in the employee name. :)
  <img src="https://i.stack.imgur.com/ryvRT.png" alt="image"></p>
  
  <p>Also here's is my code.</p>
  
  <pre><code>&lt;!--Create--&gt;
  &lt;?php
    include "config.php";
    include "header.php";
  ?&gt;
  &lt;?php
    if(isset($_POST['bts'])):
      if($_POST['id']!=null &amp;&amp; $_POST['en']!=null &amp;&amp; $_POST['date']!=null &amp;&amp; $_POST['dp']!=null &amp;&amp; $_POST['deduc']!=null){
         $stmt = $mysqli-&gt;prepare("INSERT INTO personal(id_personal,name,date,datepaid,deduction) VALUES (?,?,?,?,?)");
         $stmt-&gt;bind_param('sssss', $id, $en, $date, $dp, $deduc);
  
         $id = $_POST['id'];
         $en = $_POST['en'];
         $date = $_POST['date'];
         $dp = $_POST['dp'];
         $deduc = $_POST['deduc'];
  
         if($stmt-&gt;execute()):
  ?&gt;
  &lt;p&gt;&lt;/p&gt;
  &lt;div class="alert alert-success alert-dismissible" role="alert"&gt;
    &lt;button type="button" class="close" data-dismiss="alert"&gt;&lt;/button&gt;
    &lt;strong&gt;Alright!&lt;/strong&gt; Successfully added.
  &lt;/div&gt;
  &lt;?php
    endif;
    } else {
  ?&gt;
  &lt;p&gt;&lt;/p&gt;
  &lt;div class="alert alert-warning alert-dismissible" role="alert"&gt;
    &lt;button type="button" class="close" data-dismiss="alert"&gt;&lt;/button&gt;
    &lt;strong&gt;Error!&lt;/strong&gt; You must fill all the blanks.
  &lt;/div&gt;
  &lt;?php
  }
    endif;
  ?&gt;
    &lt;p&gt;
  &lt;/p&gt;
  &lt;div class="panel panel-default"&gt;
    &lt;div class="panel-body"&gt;
    &lt;form role="form" method="post"&gt;
      &lt;div class="form-group"&gt;
        &lt;label for="id"&gt;Employee ID&lt;/label&gt;
        &lt;input type="text" class="form-control" name="id" id="id" placeholder="Enter ID"/&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
        &lt;label for="en"&gt;Employee Names&lt;/label&gt;
        &lt;select class="form-control" id="en" name="en"&gt;
          &lt;option&gt;Choose&lt;/option&gt;
          &lt;?php
            include("alqdb.php");
            $result=mysqli_query($con, "SELECT EmpFName FROM employee");
            while($row=mysqli_fetch_assoc($result)){
              echo "&lt;option&gt;".$row["EmpFName"]."&lt;/option&gt;";
            }
          ?&gt;
          &lt;/select&gt;
        &lt;/select&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
        &lt;label for="date"&gt;Date&lt;/label&gt;
        &lt;input type="date" class="form-control" name="date" id="date"/&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
        &lt;label for="dp"&gt;Date to be Paid&lt;/label&gt;
        &lt;input type="date" class="form-control" name="dp" id="dp"/&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
        &lt;label for="sal"&gt;Salary&lt;/label&gt;
        &lt;input type="text" class="form-control" name="sal" id="sal" placeholder="Salary"/&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
        &lt;label for="amnt"&gt;Amount&lt;/label&gt;
        &lt;input type="text" class="form-control" name="amnt" id="amnt" placeholder="Enter Amount"/&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
        &lt;label for="deduc"&gt;Deduction&lt;/label&gt;
        &lt;input type="text" class="form-control" name="deduc" id="deduc" value="0.00" readonly/&gt;
      &lt;/div&gt;
      &lt;button type="submit" name="bts" class="btn btn-default"&gt;Ok&lt;/button&gt;
    &lt;/form&gt;
  &lt;?php
    include "footer.php";
  ?&gt;
  &lt;!--Table--&gt;
  &lt;?php
    include "config.php";
    include "header.php";
  ?&gt;
    &lt;p&gt;
  &lt;/p&gt;
  &lt;label&gt;List of Transactions&lt;/label&gt;
  &lt;table id="ghatable" class="display table table-bordered table-stripe" cellspacing="0" width="100%"&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;ID&lt;/th&gt;
        &lt;th&gt;Name&lt;/th&gt;
        &lt;th&gt;Date&lt;/th&gt;
        &lt;th&gt;Date to be Paid&lt;/th&gt;
        &lt;th&gt;Deduction&lt;/th&gt;
        &lt;th&gt;Action&lt;/th&gt;
       &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;?php
      $res = $mysqli-&gt;query("SELECT * FROM personal");
      while ($row = $res-&gt;fetch_assoc()):
    ?&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;?php echo $row['id_personal'] ?&gt;&lt;/td&gt;
        &lt;td&gt;&lt;?php echo $row['name'] ?&gt;&lt;/td&gt;
        &lt;td&gt;&lt;?php echo date("F j, Y", strtotime($row['date'])) ?&gt;&lt;/td&gt;
        &lt;td&gt;&lt;?php echo date("F j, Y", strtotime($row['datepaid'])) ?&gt;&lt;/td&gt;
        &lt;td&gt;&lt;?php echo $row['deduction'] ?&gt;&lt;/td&gt;
        &lt;td&gt;
          &lt;a href="update.php?u=&lt;?php echo $row['id_personal'] ?&gt;"&gt;&lt;span class="glyphicon glyphicon-pencil" aria-hidden="true"&gt;&lt;/span&gt; Edit&lt;/a&gt;
          &lt;a onclick="return confirm('Are you want deleting data')" href="delete.php?d=&lt;?php echo $row['id_personal'] ?&gt;"&gt;&lt;span class="glyphicon glyphicon-trash" aria-hidden="true"&gt;&lt;/span&gt; Delete&lt;/a&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;?php
      endwhile;
    ?&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  &lt;?php
    include "footer.php";
  ?&gt;
  &lt;script type="text/javascript" src="js/jquery.js"&gt;&lt;/script&gt;
  &lt;script language="javascript"&gt;
      $("#amnt, #sal").keyup(function() {
          $("#deduc").val(($("#sal").val() - $("#amnt").val()).toFixed(2));
      });
  &lt;/script&gt;
  </code></pre>