title: Get the id value PHP, mysql, jquery
body: <p>I want to get the <strong>ID</strong> value in the <code>department_tbl</code> and put it in the <code>TextBox</code> instead of <code>Alert</code>.</p>
  
  <pre><code>&lt;select name="departmentlvl" id="departmentlvl"&gt;
      &lt;option value="" &gt;Choose Department Level&lt;/option&gt;
      &lt;?php
          $qry="Select * from department_tbl";
          $result=mysqli_query($conn,$qry);
          while($row = mysqli_fetch_array($result))
          {
              extract($row);
              echo "&lt;option value='".$department_id."'&gt;".$departmentDesc."
           &lt;/option&gt;";
  
          }
      ?&gt; 
  &lt;/select&gt;
  &lt;input type="text" id="" value=""&gt;// put the id value here($department_id)
  
  //jquery
  $(document).ready(function() {
      $("#departmentlvl").on('change', function () {
          alert($(this).val());
      });
  });
  </code></pre>