Page 1 of 1
multiple drop down menus
Posted: Thu Oct 14, 2010 2:06 am
by cholam20
Gurus,
I am a niewbie in php. I have to modify an already existing code.
To populate second drop down menu as per the selected value of first drop down menu. Values of First drop down menu is from a mysql database + php. Now I have to insert a sub category menu in javascript by passing the selected value of the first dropdown.
Pls help.
thanks
Re: multiple drop down menus
Posted: Thu Oct 14, 2010 7:20 am
by kalpesh.mahida
Hi,
Take a look at Simple chained combobox jQuery plugin at
http://www.codeassembly.com/Simple-chai ... or-jQuery/
Hope this will help you,
Kalpesh Mahida
Re: multiple drop down menus
Posted: Fri Oct 15, 2010 12:02 am
by cholam20
Please help me how to proceed after this code.
<td>
<select name="topicId">
<option value="" selected >Select One</option>
<?
$services= db_query('SELECT topic_id,topic FROM '.TOPIC_TABLE.' WHERE isactive=1 ORDER BY topic');
if($services && db_num_rows($services)) {
while (list($topicId,$topic) = db_fetch_row($services)){
$selected = ($info['topicId']==$topicId)?'selected':''; ?>
<option value="<?=$topicId?>"<?=$selected?>><?=$topic?></option>
<?
}
}else{?>
<option value="0" >General Inquiry</option>
<?}?>
</select>
<font class="error">* <?=$errors['topicId']?></font>
</td>
</tr>
After this as per the value selected in the above drop down menu, a javascript shld be written such a way that the next menu values depend on the first menu.
There are only 2 values in the first menu and hence with if condition it may be written in javascript.
Pls help how to proceed.
regds