kod JS:
<script type="text/javascript"> var ajax = new sack(); function getRodzList(sel) { var Code = sel.options[sel.selectedIndex].value; document.getElementById('produkt1').options.length = 0; // Empty city select box if(Code.length>0){ ajax.requestFile = 'por.php?Code='+Code; // Specifying which file to get ajax.onCompletion = createProd; // Specify function that will be executed after file has been found ajax.runAJAX(); // Execute AJAX function } var Code1 = sel.options[sel.selectedIndex].value; document.getElementById('produkt2').options.length = 0; // Empty city select box if(Code1.length>0){ ajax.requestFile = 'por1.php?Code1='+Code1; // Specifying which file to get ajax.onCompletion = createProd1; // Specify function that will be executed after file has been found ajax.runAJAX(); // Execute AJAX function } } function createProd() { var obj = document.getElementById('produkt1'); eval(ajax.response); // Executing the response from Ajax as Javascript code } function createProd1() { var obj1 = document.getElementById('produkt2'); eval(ajax.response); // Executing the response from Ajax as Javascript code } </script> kod1 i glowna strona: <form action="porownanie.php" method="get" name="compere"> <table class="szukaj_form"> <tr> <?PHP include"connect.php"; $zapytanie="SELECT DISTINCT Rodzaj FROM produkty"; $rezultat=mysql_query($zapytanie); while($a=mysql_fetch_array($rezultat)){ $rodz1=$a["Rodzaj"]; echo " <option>$rodz1</option>"; } ?> </select> </td> </tr> <tr> </select> </td> </tr> </tr> <tr> </select> </td> </tr> </tr> </td> </table> </form>
kod2 i plik w ktorym pobiera sie dane do drugiego selekta dla drugiego lelecta taki sam tyle ze code1 a nie code:
<?php { include"connect.php"; $zapytanie="SELECT Id, Nazwa FROM produkty WHERE Rodzaj = '".mysql_real_escape_string($_GET['Code'])."'"; } } ?>
bede wdzieczny za sugestie