hi! i'm new here..my english is poor..:'(

i'm doing my industrial training..i just want to ask..how to make a selection:
*negeri = state *

  my question is by using these code..
  --> how to make a state select then the branch will appear together if related? 
  hope my english is okay..hehe..
  example..if i select state in Malaysia..eg: hi! i'm new here..my english is poor..:'(

i'm doing my industrial training..i just want to ask..how to make a selection:
#negeri = state #

  my question is by using these code..
  --> how to make a state select then the branch will appear together if related? 
  hope my english is okay..hehe..
  example situation : if i'm select state in Malaysia..eg: Malaysia == JOHOR
                                                                       MELAKA etc..

HERE MY CODE IN PHP..

 #negeri = state #

  <select name="NEGERI" class="select" id="NEGERI">
        <option value ="0">-- Sila Pilih --</option>

                <?php
                    //$sql = "SELECT * FROM negeri where FLAG=1 ORDER BY negeri ASC";
                    $sql = "SELECT * FROM negeri WHERE  negeri_id = '".$NEGERI."'  FLAG=1 ORDER BY negeri ASC";

                    $result_groups = mysql_query($sql);
                    $result_group_member = mysql_numrows ($result_groups);

                    if($result_group_number > 0)  {
                        while ($myrow = mysql_fetch_array($result_group))  {

                        if ($NEGERI == $myrow["negeri_id"])
                            echo "<option value = ".$myrow["negeri_id"]." selected > ".$myrow["negeri"]."</option>\n";

                        else "<option value =".$myrow["negeri_id"].">".$myrow["negeri"]."</option\n";
                        }
                        }
                        ?>  


     # cawangan = branch  #

     <?
                 $sql2 = "SELECT * FROM negeri_cawangan WHERE  cawangan_id = '".$CAWANGAN."'  FLAG=1 ORDER BY cawangan ASC";

                 $result_groups2 = mysql_query($sql);
                 $result_group_number2 = mysql_numrows2($result_groups2);

                 if($result_group_number2 > 1) {
                 while ($myrow2 = mysql_fetch_array($result_groups2)) {


                    if ($CAWANGAN == $myrow2["cawangan_id"])
                    echo "<option value=".$myrow2["cawangan_id"]." selected > ".$myrow["cawangan"]."</option>\n";
                    else
                    echo "<option value = ".$myrow2["cawangan_id"]." > ".$myrow2["cawangan"]."</option>\n";
                    }
                    }
                    ?>

hope you guys would help me..

if i select State JOHOR..auto the Branch of Johor will appear together..not all branch in Malaysia will appear..help me!!:'(

$negri='".$_REQUEST['']."';

This sql statement should be somthing like this.

$sql = "SELECT * FROM negeri WHERE negeri_id ='$negeri' FLAG=1 ORDER BY negeri ASC";

why still can not be used after i using $negri='".$_REQUEST[''].";?
plus where should i put $negri='".$_REQUEST[''].";..?
i'm sory because i'm still new in php...sory for my bad english:'(

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.