title: Fill the fields of a form from mysql query result
body: <p>In my project it has an interface(designation.php) which has a form. When a user enters a 'designation code'(which is a primary key) and click the 'update' button, the 
  remaining fields should be filled accordingly. I understand that Ajax will be needed for this. 
  but the problem is,  i'm done with retrieving the result only as a single row from the database by using following query. but, this is not my objective. </p>
  
  <pre><code>while($row = mysqli_fetch_assoc($run1)) {
     echo "&lt;tr id='tr'&gt;";
     foreach($row AS $cell) echo "&lt;td&gt;$cell&lt;/td&gt;";
     echo "&lt;/tr&gt;\n";
  }
  </code></pre>
  
  <p>Following is the 'designation.php'..</p>
  
  <pre><code>&lt;form action="crud.php" method="post"&gt;
  &lt;table&gt;
    &lt;th &gt;DESIGNATION&lt;/th&gt;
    &lt;tr&gt;
    &lt;td &gt;Designation Code&lt;/td&gt;
    &lt;td &gt;&lt;input type="text" name="des_code" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td &gt;Designation&lt;/td&gt;
    &lt;td&gt;&lt;input type="text" name="desig" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td &gt;Salary Code&lt;/td&gt;
    &lt;td&gt;&lt;input type="text" name="s_code" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td &gt;Salary Scale&lt;/td&gt;
    &lt;td&gt;&lt;input type="text" name="s_scale" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td &gt;Salary point &lt;/td&gt;
    &lt;td&gt;&lt;input type="text" name="s_point" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Date&lt;/td&gt;
    &lt;td &gt; &lt;input type="date" name="date" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;input type="submit" name="update" value="Update" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>I attempted many solutions but have not gotten the intended result. Any help is appreciated.</p>