Note that there are some explanatory texts on larger screens.

plurals
  1. PORelated select inputs
    text
    copied!<p>Can anybody help me on this. For showing the rezults from an MySql database i have to select school, class, subject, and exam. But listing all the classes or all the exams is not very practical so i want to do another function that when i choose some schools in the first select box it shows me in the second select box only the classes of the selected schools.</p> <p>My code is:</p> <pre><code> &lt;div id="allselects"&gt; &lt;form action="viewing.php" method="post" name="filt"&gt; &lt;div class="multsarrange"&gt; &lt;h1 class="choosetext" &gt;Chose Schools&lt;/h1&gt; &lt;select class="multipleselect" name="schools[]" size="8" multiple="multiple" id="shkll"&gt; &lt;?php $sql = "SELECT * FROM schools "; $scc=mysql_query($sql); while ($db_f = mysql_fetch_assoc($scc)) { $schcd=$db_f['schoolcode']; $schc=$db_f['schoolname']; echo "&lt;option value=$schcd &gt;$schc&lt;/option&gt;"; } ?&gt; &lt;/select&gt; &lt;/div&gt; &lt;div class="multsarrange" id="clasaajax"&gt; &lt;h1 class="choosetext" &gt;Chose an Classes&lt;/h1&gt; &lt;select class="multipleselect" name="classes[]" size="8" multiple="multiple" "&gt; &lt;?php $c = "SELECT * FROM classes "; $cl=mysql_query($c); while ($db_f = mysql_fetch_assoc($cl)) { $clsc=$db_f['schoolID']; $claid=$db_f['classID']; $clay=$db_f['year']; $clanm=$db_f['className']; $name=schoolidton($clsc)." ".$clay." ".$clanm; echo "&lt;option value=$claid &gt;$name&lt;/option&gt;"; } ?&gt; &lt;/select&gt; &lt;/div&gt; &lt;div class="multsarrange"&gt; &lt;h1 class="choosetext" &gt;Chose Subjects&lt;/h1&gt; &lt;select class="multipleselect" name="subjects[]" size="8" multiple="multiple"&gt; &lt;?php $sb = "SELECT * FROM subjects "; $sbi=mysql_query($sb); while ($db_f = mysql_fetch_assoc($sbi)) { $sbnm=$db_f['subjectName']; $sbid=$db_f['subjectID']; echo "&lt;option value=$sbid &gt;$sbnm&lt;/option&gt;"; } ?&gt; &lt;/select&gt; &lt;/div&gt; &lt;div class="multsarrange"&gt; &lt;h1 class="choosetext" &gt;Chose Exams&lt;/h1&gt; &lt;select class="multipleselect" name="exams[]" size="8" multiple="multiple"&gt; &lt;?php $e = "SELECT * FROM exams "; $ex=mysql_query($e); while ($db_f = mysql_fetch_assoc($ex)) { $id=$db_f['examID']; $sub=$db_f['subjectID']; $desc=$db_f['description']; $year=$db_f['year']; $data=$db_f['data']; $exnam=subidton($sub)." - ".$year." - ".$desc." - ".$data; echo "&lt;option value=$id &gt;$exnam&lt;/option&gt;"; } ?&gt; &lt;/select&gt; &lt;/div&gt; &lt;div id="longsubmit"&gt; &lt;/br&gt;&lt;/br&gt; &lt;input name="submit" type="submit" value="View" /&gt; &lt;/div&gt; &lt;/form&gt; &lt;/div&gt; </code></pre>
 

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