i have two drop down boxes and when user select District from 1st drop down box , the cityis in that district should load to the second drop down. My code is below. But it is not working. Please tell me what is incorrect with it. <tr> <td width="111"> <form action="test.php" method="post" name="test" > <select name="District" class="defaultBlackText" onchange="this.form.submit();"> <option <?php if ($_POST['District'] == 'G1') print 'selected '; ?> value="G1">G1</option> <option <?php if ($_POST['District'] == 'G2') print 'selected '; ?> value="G2">G2</option> <option <?php if ($_POST['District'] == 'G3') print 'selected '; ?> value="G3">Kurunegala</option> </select> </form> </td> <td width="15"> </td> <td width="145"> <form action="test.php" method="post" name="testl"> <select name="city" onchange="this.form.submit();"> <option value="Select">Select</option> </select> </form> </td> <td width="138"><?php if (isset($_POST['District'])) { echo $_POST['District']; $District=$_POST['District']; $q="SELECT * FROM xxx WHERE District='".$District."' "; $result=mysql_query($q) or die ("Could not execute query: $q.".mysql_error()); while($row=mysql_fetch_array($result)){ foreach( $row AS $key => $val ){ $key = stripslashes( $val ); } } } ?> </td> <td width="158"> </td> <td width="12"> </td> <td width="190"></td> <td> </td> </tr> PHP: