Hi there every one,
Please i have a form with 3 dropdown list.
the first is for a canditate, 2nd is for party, 3rd is for state and 4th is for the local areas in the state.
I want if the user selects a state, the dropdown list for the local area to be populated automatically.
But since they are on the same form i am not sure how.here is my code
PHP Code:
    <td><select name="state" tabindex="3">
                 <?php #this is to get listing for roles in a drop dowm menu 
                       #the sql query
                          
$sql1 "SELECT distinct(state_name) FROM state order by state_name ";
                      
#execute query
                          
$rs1 mysql_query($sql1$myConn) or die ("could not execute query $sql");
          
                      if (
$rs1){  
                              while (
$row1 mysql_fetch_array ($rs1)){
                                           echo(
"<option>" $row1['state_name'] . "</option>"); 
                                       }
                          }
                       else{
                                  echo 
"<option> No states have been registered - Add Please </option>";
                           }
                           
                       
mysql_free_result($rs);
    

                
?>
        </select></td>
    </tr>
    <?php $stid$row1['state_name']; ?>* here is what i thot of 
    <tr>
        <td> <label> Select Local Goverment </label></td>
        <td><select name="localgov" tabindex="4">
                 <?php 
                         $sql2 
"SELECT distinct(name) FROM lg order by name where state_id=(select state_id from state where state_name=\"$stid\")";
                      
#execute query
                          
$rs2 mysql_query($sql2$myConn) or die ("could not execute query $sql");
          
                      if (
$rs2){  
                              while (
$row2 mysql_fetch_array ($rs2)){
                                           echo(
"<option>" $row2['name'] . "</option>"); 
                                       }
                          }
                       else{
                                  echo 
"<option> No local governemnts have been registered - Add Please </option>";
                           }
                           
                       
mysql_free_result($rs);
    

                
?>
        </select></td>
    </tr>
Thank you.