title: PHP - Auto-fill text-boxes based upon drop-down value selected?
body: <p>Morning all,</p>
  
  <p>I'm building a web app in HTML/ PHP and have an edit product page which has a select drop-down which is populated from the products stored in a MySQL database. Image of the form below;  </p>
  
  <p><a href="https://i.stack.imgur.com/ZslLW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZslLW.png" alt="Edit product form"></a> </p>
  
  <p>The corresponding data for each field is stored also in the database, I can not work out for the life of me how I get the textboxes to feature the corresponding information when the product is selected via the dropdown, and I am struggling to find any tutorials on how I can get this too work? I understand that I may need to use AJAX to fetch the informaiton without reloading the page. Apologies for noob quesitons I'm new too this,</p>
  
  <p>As always, any help appriciated,</p>
  
  <p>Thanks. </p>
  
  <p>PHP So far which populates the select dropdown:</p>
  
  <pre><code>&lt;?php
      or die ('Cannot connect to db');
  
      $result = $conn-&gt;query("select ID, NAME from PRODUCTS");
      print "&lt;h3&gt;EDIT PRODUCT&lt;/h3&gt;"; 
      print "&lt;p&gt;&amp;nbsp;&lt;strong&gt;SELECT PRODUCT: &lt;br&gt;&lt;br&gt;&lt;/strong&gt;" . "&lt;select name='ID'";
  
      while ($row = $result-&gt;fetch_assoc()) {
          unset($id, $name);
          $id = $row['ID'];
          $name = $row['NAME']; 
          echo '&lt;option value="'.$id.'"&gt;'.$name.'&lt;/option&gt;';
      }
  ?&gt;
  </code></pre>