title: binding drop down list according to id PHP
body: <p>I would like to display drop down list according to the database below. (bom table)</p>
  
  <p>For example, when I choose 'Table' from the drop down list, it would display the bom_description, bom_quantity and UOM.</p>
  
  <pre><code>bom_id |bom_description |product_id |finish_product |bom_quantity |UOM
  1        Table Tops        1            Table             1        /PC
  2        Table Legs        2            Chair             4        /PC
  3        Chair Seat        3                              1        /PC
  4        Chair Back        4                              1        /PC
  5        Chair Legs        5                              4        /PC
  </code></pre>
  
  <p>Select Product: Table (A drop down list)</p>
  
  <p>(HTML table will display these)</p>
  
  <pre><code>bom_description |bom_quantity |UOM
  Table Tops        1             /PC
  Table Legs        4             /PC
  </code></pre>
  
  <p>When I click on Chair, it will show this</p>
  
  <p>Select Product: Chair (A drop down list)</p>
  
  <pre><code>bom_description |bom_quantity |UOM
  Chair Seat        1             /PC
  Chair Back        1             /PC
  Chair Legs        4             /PC
  </code></pre>
  
  <p>Right now, this is my code but the html table to display the content are not appearing.</p>
  
  <pre><code>    &lt;script src="script/jquery-1.11.1.min.js"&gt;&lt;/script&gt;
      &lt;script&gt;
          $(document).ready(function () {
              $(".itemTypes").change(function () {
                  if (this.value == 0) {
                      $("tr").show();
                  }
                  else {
                      $("tr").hide();
                      $(".header").show();
                      $("." + this.value).show();
                  }
              });
          });
      &lt;/script&gt;
  
  &lt;?php
      session_start();
  
  if (!isset($_SESSION['username'])) {
      header('location: homepage.php');
  }
  
  //connect to database
  include ("dbFunctions.php");
  
  $queryBOM = "SELECT * FROM bom";
  
  $resultBOM = mysqli_query($link, $queryBOM) or die(mysqli_error($link));
  mysqli_close($link);
  ?&gt;
  
  Select Product:
                          &lt;select class="itemTypes"&gt;
                              &lt;option value="0"&gt;
                                  all types
                              &lt;/option&gt;
                              &lt;?php
                              while ($row1 = mysqli_fetch_array($resultBOM)) {
                                  ?&gt;
                                  &lt;option value="&lt;?php echo $row1['finish_product']; ?&gt;"&gt;
                                      &lt;?php echo $row1['finish_product']; ?&gt;
                                  &lt;/option&gt;
                              &lt;?php } ?&gt;&lt;/select&gt;
                          &lt;p&gt;
  
  
                              &lt;table border="1"&gt;
                                  &lt;tr&gt;
                                      &lt;th&gt;BOM Description&lt;/th&gt;
                                      &lt;th&gt;Quantity&lt;/th&gt;
                                      &lt;th&gt;UOM&lt;/th&gt;
                                      &lt;th colspan="2"&gt;Action&lt;/th&gt;
  
                                      &lt;?php
                                      while ($row = mysqli_fetch_assoc($resultBOM)) {
                                          $bom_description = $row['bom_description'];
                                          $bom_quantity = $row['bom_quantity'];
                                          $UOM = $row['UOM'];
                                          ?&gt;
  
                                          &lt;tr&gt;
                                              &lt;td&gt;&lt;center&gt;&lt;?php echo $bom_description; ?&gt;&lt;/center&gt;&lt;/td&gt;
                                              &lt;td&gt;&lt;center&gt;&lt;?php echo $bom_quantity; ?&gt;&lt;/center&gt;&lt;/td&gt;
                                              &lt;td&gt;&lt;center&gt;&lt;?php echo $UOM; ?&gt;&lt;/center&gt;&lt;/td&gt;
                                              &lt;td&gt;&lt;center&gt;
                                                      &lt;form method="post" action="editBOM.php"&gt;
                                                          &lt;input type="hidden" name="bomID" value="&lt;?php echo $bom_id; ?&gt;" /&gt;
                                                          &lt;input type="image" src="images/editicon.png" name="edit" value="edit" style="width:30px;height:30px;"/&gt;
                                                  &lt;/center&gt;&lt;/form&gt;
                                              &lt;/td&gt;
                                              &lt;td&gt;&lt;center&gt;
                                                      &lt;form method="post" action="dodeleteBOM.php"&gt;
                                                          &lt;input type="hidden" name="bomID" value="&lt;?php echo $bom_id; ?&gt;" /&gt;
                                                          &lt;input type="image" src="images/deleteicon.png" name="delete" value="delete" style="width:25px;height:25px;"/&gt;
                                                  &lt;/center&gt;&lt;/form&gt;
                                                  &lt;/center&gt;&lt;/td&gt;
                                              &lt;?php
                                          }
                                          ?&gt;
                                      &lt;/tr&gt;
  </code></pre>
  
  <p>How to solve this problem?</p>