Note that there are some explanatory texts on larger screens.

plurals
  1. POGet data from database and put in SELECT TAG
    primarykey
    data
    text
    <p>I have three select tags (1)Category, (2)Sub-Category, (3)Product Description and I want to fill it with data from database. But what I want is to when I select eg. Office Supplies from the Category on the Sub Category will only display eg. Ballpen, Ruler, Notebook and when I select eg. Ballpen on the Product Description will only display the description of the Ballpen. Btw I had created some code made from PHP but it only fills the select tags. I hope someone will help me. This is for out Thesis. :)</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Test Select&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;?php $query = "SELECT DISTINCT(`product_cate`) FROM `tbl_product` "; $result = mysql_query($query); ?&gt; Category: &lt;select id="select1"&gt; &lt;option&gt;&lt;/option&gt; &lt;?php while($data = mysql_fetch_array($result)){ $displayData = $data['product_cate']; ?&gt; &lt;option value="&lt;?php echo $displayData;?&gt;"&gt;&lt;?php echo $displayData; ?&gt;&lt;/option&gt; &lt;?php } ?&gt; &lt;/select&gt; &lt;?php $query2 = "SELECT DISTINCT(`product_sub`) FROM `tbl_product`"; $result2 = mysql_query($query2); ?&gt; Sub Category: &lt;select id="select2"&gt; &lt;option&gt;&lt;/option&gt; &lt;?php while($data2 = mysql_fetch_array($result2)){ $displayData2 = $data2['product_sub']; ?&gt; &lt;option value="&lt;?php echo $displayData2;?&gt;"&gt;&lt;?php echo $displayData2;?&gt;&lt;/option&gt; &lt;?php }?&gt; &lt;/select&gt; &lt;?php $query3 = "SELECT DISTINCT(`product_desc`) FROM `tbl_product`"; $result3 = mysql_query($query3); ?&gt; Product Description: &lt;select id="select3"&gt; &lt;option&gt;&lt;/option&gt; &lt;?php while($data3 = mysql_fetch_array($result3)){ $displayData3 = $data3['product_desc']; ?&gt; &lt;option value="&lt;?php echo $displayData3;?&gt;"&gt;&lt;?php echo $displayData3;?&gt;&lt;/option&gt; &lt;?php }?&gt; &lt;/select&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload