hello sir, anyone can help me where can i learn about chained select box because i want to make 3 chained select box and saved it into database
chained select box
Collapse
X
-
Code:<script type="text/javascript" src="ajax.js"></script> <script type="text/javascript"> var ajax = new Array(); function getCityList(sel) { var countryCode = sel.options[sel.selectedIndex].value; document.getElementById('dhtmlgoodies_city').options.length = 0; // Empty city select box if(countryCode.length>0){ var index = ajax.length; ajax[index] = new sack(); ajax[index].requestFile = 'getCities.php?countryCode='+countryCode; // Specifying which file to get ajax[index].onCompletion = function(){ createCities(index) }; // Specify function that will be executed after file has been found ajax[index].runAJAX(); // Execute AJAX function } } function createCities(index) { var obj = document.getElementById('dhtmlgoodies_city'); eval(ajax[index].response); // Executing the response from Ajax as Javascript code } </script>
[HTML]<form action="" method="post" name="form1">
<p> </p>
<table width="729" height="226" align="center">
<tr>
<td width="131" class="style28" >Matric No:</td>
<td width="360" class="style28" ><input name="matric" type="text" id="matric" value="<?php echo $row_phse2['matric_no']; ?>" size="15" /></td>
<td width="126" height="30" class="style28" > </td>
<td width="92" class="style28" > </td>
</tr>
<tr>
<td class="style28" >Name:</td>
<td class="style28" ><input name="name" type="text" id="name" value="<?php echo $row_phse2['name']; ?>" size="60" /></td>
<td height="21" class="style28" > </td>
<td class="style28" > </td>
</tr>
<tr>
<td height="21" class="style28" ><span>Sessi</span>:</td>
<td class="style28" ><input name="session" type="text" id="session" size="15" maxlength="9" /></td>
<tr>
<td width="131" height="24"><sp an class="style36" >Year</span>: </td>
<td width="360"><se lect name="dhtmlgood ies_country" id="dhtmlgoodie s_country" onChange="getCi tyList(this)">
<option value="">Select a year</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select> </td>
</tr>
<tr>
<td height="24"><sp an class="style36" >Block</span>: </td>
<td><select name="dhtmlgood ies_city" id="dhtmlgoodie s_city">
</select> </td>
</tr>
<tr>
<td class="style28" >Subject Code:</td>
<td class="style28" ><select name="s_code" id="s_code">
<option value="-">-</option>
<option value="MED 3111">MED 3111</option>
<option value="MED 3211">MED 3211</option>
<option value="MED 3311">MED 3311</option>
<option value="MED 3411">MED 3411</option>
<option value="MED 3411">MED 3411</option>
<option value="MED 4112">MED 4112</option>
<option value="MED 4212">MED 4212</option>
<option value="MED 4402">MED 4402</option>
<option value="MED 4502">MED 4502</option>
<option value="MED 4602">MED 4602</option>
<option value="MED 4702">MED 4702</option>
<option value="MED 5108">MED 5108</option>
<option value="MED 5208">MED 5208</option>
<option value="MED 5308">MED 5308</option>
<option value="MED 5408">MED 5408</option>
<option value="MED 5508">MED 5508</option>
</select></td>
<td height="24" class="style28" > </td>
<td class="style28" > </td>
<tr>
<tr>
<td height="24" class="style28" >Group:</td>
<td class="style28" ><select name="group" size="1" id="group">
<option value="-">-</option>
<option value="1" >1</option>
<option value="2" >2</option>
<option value="3" >3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select></td>
</tr>[/HTML]
this is my html code... it supposed made the subject code appear according to the year and the block... but i fail to made it.... and it can't save into the databaseComment
-
The getCityList and createCities function are specific to one select. If you make them generic by passing the ID of the select to populate, you could reuse it for the second select. It would also be a good idea to change the names because they've got nothing to with cities.Comment
Comment