title: Get the options for second select depending on the value of my fisrt select
body: <p>Hi I'd like some help please.</p>
  
  <p>I'm having 2 dropdown menus. In the first one I pick the name of a city</p>
  
  <pre><code>&lt;select id="select1" class="select" name="city"&gt;
  &lt;option value="101000000"&gt;city1&lt;/option&gt;
  &lt;option value="102000000"&gt;city2&lt;/option&gt;
  &lt;option value="103000000"&gt;city3&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>and in 2nd one I want to display dynamicly all municipalities of the selected city each time</p>
  
  <pre><code>&lt;select id="select2" name="municipality[]" multiple="multiple"&gt;&lt;/select&gt;
  </code></pre>
  
  <p>So in order to fetch all municipalities I do this</p>
  
  <pre><code>&lt;script&gt;
      $("#select1").on("change", function() {
          var x = $("#select1").val();
  
          $.ajax({
              type: "POST",
              url: "fetch_municipalities.php",
              // async: false,
              data:"level1="+x,
              success:function(data){
                  // alert(data);
  
                  $("#select2").html(data).multiselect(); 
              },
              error:function (xhr, ajaxOptions, thrownError) {
                  alert(xhr.status);
                  alert(thrownError);
              }
          });
      });
  &lt;/script&gt;   
  </code></pre>
  
  <p>This is my fetch_municipalities.php</p>
  
  <pre><code>if(isset($_POST['level1'])) {
      $post_lvl2 =  $_POST['level1'];
      // die($_POST['level1']);
      // echo $_POST['level1'];
  
      $sql = 'SELECT * FROM L_Areas WHERE CentralAreaID = ' . $post_lvl2;
      $query = mysqli_query($db, $sql);
  
     $filter_list_lvl2 = '';
  
      while($row = $query-&gt;fetch_assoc()){ 
  
          $name_lvl2 = $row['AreaName'] ;            
          $id_lvl2 = $row['AreaID'] ;
          $central_lvl2= $row['CentralAreaID'] ;
  
          // the option tags
          $filter_list_lvl2 .=  '&lt;option value="' . $id_lvl2 . '"&gt;' . $name_lvl2 . '&lt;/option&gt;';
      } 
  
      echo $filter_list_lvl2; 
  }
  </code></pre>
  
  <p>So If I select city1 the first time I get all municipalities of city1, but when I select another city (eg city2) the municipalities don't change (remains from city1).</p>
  
  <p>How can I fix this?</p>