title: display data from another table when select option is being selected using js?
body: <p>I've been trying to generate data from select box, I made a simple query to database where it will generate list of categories in selection box. Now my problem is that, how do i get data from another table that will promptly display if the selectbox is being selected. I believe there is a javascript related to this for much easier way. Can someone please tell me, or illustrate how should it be done?</p>
  
  <pre><code>&lt;select name="categoryID" id="" class="form-control" required&gt;
              &lt;option value="" default&gt;SELECT&lt;/option&gt;
              &lt;?php 
                $select = $conn-&gt;query("SELECT * FROM category");
                while ($row = $select-&gt;fetch_assoc()) {
                  $showlumber = $conn-&gt;query("SELECT * FROM inventorylumber WHERE categoryID = '$row[categoryID]'");
                  $rowLumber = $showlumber-&gt;fetch_assoc();
              ?&gt;
              &lt;option value="&lt;?php echo $row['categoryID']; ?&gt;"&gt;&lt;?php echo $row['categoryName']; ?&gt;                  
              &lt;/option&gt;
  
              &lt;?php } ?&gt;
  
            &lt;/select&gt;
            &lt;/div&gt;
              &lt;thead&gt;
                &lt;tr&gt;
                  &lt;th&gt;2 x 2&lt;/th&gt;
                  &lt;th&gt;&lt;?php echo $rowLumber['2x2x6']; ?&gt;Pcs&lt;/th&gt;
                  &lt;th&gt;&lt;?php echo $rowLumber['2x2x8']; ?&gt;Pcs&lt;/th&gt;
                  &lt;th&gt;&lt;?php echo $rowLumber['2x2x10']; ?&gt;Pcs&lt;/th&gt;
                  &lt;th&gt;&lt;?php echo $rowLumber['2x2x12']; ?&gt;Pcs&lt;/th&gt;
                  &lt;th&gt;&lt;?php echo $rowLumber['2x2x14']; ?&gt;Pcs&lt;/th&gt;
                  &lt;th&gt;&lt;?php echo $rowLumber['2x2x16']; ?&gt;Pcs&lt;/th&gt;
                &lt;/tr&gt;
              &lt;/thead&gt;
  </code></pre>