I have created a compobox and selected District from address table. I have to take the district name as a key and filter "towns" from address table and it should be displayed in the second compobox. Anyone help me what code I can use for second compobox?

The code used for the first one is working :

<form name="select_category" action="../select_category.php" method="post" >
<select name="cate" id="cate" style="width:180px;" >
<option value="select">Select District</option>
<?
$new=mysql_query("select * from address order by district asc");
while ($new12=mysql_fetch_array($new))
{
?>
<option value="<?=$new12;?>"><?=$new12;?></option>
<? } ?>
</select>
</form>

Any one give me how to write the second one?

If you want to do any client side changes you will require AJAX/Javascript to get it done else if you want to use PHP I guess you could submit the previous combo box value and refresh the page based on the attribute onselect or onchange etc. Hope that helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.