title: Interactive drop down menu that auto fills drop down values depending on what user inputs
body: <p>I'm trying to create an interactive drop down menu that uses mysqli query to autofill the values in each drop down. So far the first drop down menu echo's the Brands in the database for each part so that works fine. However the second drop down displays regardless of the $selected value being true or false, but also when I do select a brand it doesn't auto fill the results.</p>
  
  <pre><code>    &lt;?php
              foreach($parts as $col) { ?&gt;
                  &lt;dl&gt;
                      &lt;dt&gt;&lt;?php echo $col?&gt;&lt;/dt&gt;
                      &lt;dd&gt;
                          &lt;select id="search_status" name="state" data-placeholder="State"&gt;
                              &lt;?php
                             $brand = $database-&gt;fetch_col($col);
                             $selected = false;
                             ?&gt;
                                 &lt;option value=""&gt;&lt;/option&gt;
                              &lt;?php foreach($brand as $b){ ?&gt;
                                 &lt;option value="&lt;?php $selected = true; ?&gt;"&gt;&lt;?php echo $b['Brand']; ?&gt;&lt;/option&gt;
                              &lt;?php }?&gt;
                          &lt;/select&gt;
                          &lt;?php if($selected = true){
                              $item = $database-&gt;fetch_row($col, $b);
                              ?&gt;
                          &lt;select&gt;
                              &lt;option&gt;&lt;/option&gt;.
                                     &lt;?php foreach($item as $i) {?&gt;
                                     &lt;option&gt;&lt;?php echo $i['Model']; ?&gt;&lt;/option&gt;
                              &lt;?php }?&gt;
                          &lt;/select&gt;
                          &lt;?php
                          } else {
                              echo "Please select Brand";
                          }
                          ?&gt;
                          &lt;p&gt;&lt;?php
                          echo var_dump($item);
                          ?&gt;&lt;p&gt;
                      &lt;/dd&gt;
                  &lt;/dl&gt;
              &lt;?php }?&gt;
  </code></pre>
  
  <p>I'm fairly certain its the $selected variable not corresponding with the rest of the form.</p>