title: Displaying value in input field from sql database using jQuery
body: <p>I am still new to jQuery. I am trying to get the last id from a database and display it in a input field in a HTML form. When i inspect the browser i can see the value being retrieved from the database, however it is not displaying in the input field on the HTML form when i view the form, which i want it to display in the input field essentially.</p>
  <p>Please see code below:</p>
  <p><strong>jQuery</strong></p>
  <pre><code>$(document).ready(function(){
      {
          $('load_data').load(&quot;fetch.php&quot;);
      };
  });
  </code></pre>
  <p><strong>HTML Form</strong></p>
  <pre><code>&lt;form action=&quot;fetch.php&quot; method=&quot;post&quot;&gt;
     &lt;label&gt;Get Data From Database&lt;/label&gt;
     &lt;input type=&quot;text&quot; value=&quot;&quot; id=&quot;load_data&quot;&gt;&lt;/input&gt;
  &lt;button type=&quot;submit&quot; value=&quot;submit&quot;&gt;Submit&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  <p><strong>fetch.php file</strong></p>
  <pre><code>&lt;?php
   
  include('server.php');
  
  $sql =&quot;SELECT * FROM contents ORDER BY id DESC LIMIT 1&quot;;
  $res = mysqli_query($con, $sql);
  
  if(mysqli_num_rows($res) &gt;0)
  
  {
      while($row = mysqli_fetch_array($res))
  
      {
          echo $row[&quot;new_base&quot;];
      }
  }
  
  ?&gt;
  </code></pre>