title: Populate checkboxes based on dropdown selection
body: <p>In a form, I do have a list of industries populated from db. I want to populate a list of checkboxes based on the selected industry.</p>
  
  <p>I tried the below but its not working. <strong>Can you please help</strong>. I am still learning to code and would really appreciate your help.</p>
  
  <p><strong>index.php</strong></p>
  
  <pre><code>// The dropdown is populated from DB
  &lt;select class="set_industry"&gt;
      &lt;option value="1"&gt;Healthcare&lt;/option&gt;
      &lt;option value="2"&gt;Food &amp; Beverage&lt;/option&gt;
      &lt;option value="3"&gt;Real Estate&lt;/option&gt;
  &lt;/select&gt;
  // Preferably the selection would produce var $ind_id
  .
  .
  .
  .
  // I want the below to be executed based on the selection from above
  
  &lt;?php 
  if(isset($_POST['id'])) {
    $ind_id = $_POST['id'];
    $x="SELECT * FROM srv_tbl WHERE ind_id=$ind_id";
    $res=query($x);
  
    while ($y=mysqli_fetch_array($res)) { ?&gt;
    &lt;div&gt;
      &lt;label&gt;
        &lt;input type="checkbox" value="&lt;?php echo $y['srv_id'] ?&gt;"&gt; &lt;?php echo $y['srv_name'] ?&gt;
      &lt;/label&gt;
    &lt;/div&gt;
  &lt;?php } 
  } ?&gt;
  
  &lt;script&gt;Link to js script&lt;/script&gt;
  </code></pre>
  
  <p><strong>script.js</strong></p>
  
  <pre><code>$(".set_industry").on('change', function(){ 
      var ind_id = $(this).attr("value");
      $.post("index.php", {id: ind_id}, function());  
  });
  </code></pre>