Note that there are some explanatory texts on larger screens.

plurals
  1. POdynamic drop down box from mysql
    text
    copied!<p>I got 3 input fields and each field are getting their data from its own tables called Tour type, country and destination respectively as shown </p> <pre><code> &lt;label&gt;Tour Type&lt;/label&gt; &lt;select id="element_11" name="element_11" required&gt; &lt;option value="" selected="selected"&gt;--Select--&lt;/option&gt; &lt;?php while($row=mysql_fetch_array($sql)) { $tour_type_id=$row['tour_type_id']; $name=$row['tour_name']; echo "&lt;option value='$tour_type_id'&gt;$name&lt;/option&gt;"; } ?&gt; &lt;/select&gt; &lt;label&gt;Country&lt;/label&gt; &lt;select id="element_12" name="element_12" required&gt; &lt;option value="" selected="selected"&gt;-- Select --&lt;/option&gt; &lt;?php $sql=mysql_query("Select countries_id,countries_name from countries"); while($row=mysql_fetch_array($sql)) { $cid=$row['countries_id']; $name=$row['countries_name']; echo "&lt;option value='$cid'&gt;".$name."&lt;/option&gt;"; } ?&gt; &lt;/select&gt; &lt;label&gt;Destination&lt;/label&gt; &lt;select id="element_13" name="element_13" required&gt; &lt;option value="" selected="selected"&gt;-- Select --&lt;/option&gt; &lt;?php $sql=mysql_query("Select destination_id,destination_name from destination"); while($row=mysql_fetch_array($sql)) { $destination_id=$row['destination_id']; $name=$row['destination_name']; echo "&lt;option value='$destination_id'&gt;".$name."&lt;/option&gt;"; } ?&gt; &lt;/select&gt; &lt;/div&gt; &lt;/li&gt; </code></pre> <p>This is what i got as my 3 database tables i.e. tourtype, countries and destination respectively:</p> <p><img src="https://i.stack.imgur.com/VXgB7.png" alt="enter image description here"></p> <p><img src="https://i.stack.imgur.com/djshX.png" alt="enter image description here"></p> <p><img src="https://i.stack.imgur.com/bCMHt.png" alt="enter image description here"></p> <p>I am trying to make each field dependent on each other more like a dependent drop down box. For example if i select a tour type then the 2nd drop down should populate options only relevant to what is selected from the 1st drop down and so on. In this case for e.g if i select culture ,then the 2nd drop down should only show amsterdam and belgium.</p> <p>Can anyone help me on this.</p>
 

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