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..
*negeri = state
*cawangan = branch
# if i select State JOHOR..auto the Branch of Johor will appear together..not all branch in Malaysia will appear..help me!!:'(
here my code:
Expand|Select|Wrap|Line Numbers
- <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";
- }
- }
- ?>
- where should i put the onchange event in this code?