Zobacz
ale niestety nie podłącze do tego php, bo chce te opcje wybierać z bazy. Czy ktoś się natknął na takie coś


<?php echo '<br><style> select{ width:120px; } </style><hr width="90%"> <form action="" method="post"> <table align="center"> <tr> <td align="right: valign="top" class="uni_01">Województwo:</td> <td class="uni_01"> <select id="dhtmlgoodies_country" name="dhtmlgoodies_country" onchange="getCityList(this)"> <option value="1">Dolnośląskie</option> <option value="2">Kujawsko-Pomorskie</option> <option value="3">Lubelskie</option> <option value="4">Lubuskie</option> <option value="5">Łódzkie</option> <option value="6">Małopolskie</option> <option value="7">Mazowieckie</option> <option value="8">Opolskie</option> <option value="9">Podkarpackie</option> <option value="10">Podlaskie</option> <option value="11">Pomorskie</option> <option value="12">Śląskie</option> <option value="13">Świętokrzyskie</option> <option value="14">Warmińsko-Mazurskie</option> <option value="15">Wielkopolskie</option> <option value="16">Zachodniopomorskie</option> </select> </td> <td align="right: valign="top" class="uni_01">Miasto:</td> <td class="uni_01"> <select id="dhtmlgoodies_city" name="dhtmlgoodies_city"> </select> </td> </tr> <tr> <td align="right: valign="middle" class="uni_01">Miasto:</td> <td class="uni_01"><input name="wlasne" size="20"></td> </tr> </table> </form> <hr width="90%"> '; ?>
<script type="text/javascript"> var ajax = new Array(); function getCityList(sel) { var countryCode = sel.options[sel.selectedIndex].value; document.getElementById('dhtmlgoodies_city').options.length = 0; // Empty city select box if(countryCode.length>0){ var index = ajax.length; ajax[index] = new sack(); ajax[index].requestFile = 'getCities.php?countryCode='+countryCode; // Specifying which file to get ajax[index].onCompletion = function(){ createCities(index) }; // Specify function that will be executed after file has been found ajax[index].runAJAX(); // Execute AJAX function } } function createCities(index) { var obj = document.getElementById('dhtmlgoodies_city'); eval(ajax[index].response); // Executing the response from Ajax as Javascript code } </script>
<?php include('config.php'); switch($_GET['countryCode']){ case "0": break; case "1": } else { } } break; ..... case "16": } else { } } break; } } ?>