Ciao e grazie,
posto uno script che ho trovato:
javascript
XHTMLcodice:<script type="text/javascript" src="./js/ajax.js"></script> <script type="text/javascript"> var ajax = new Array(); function creaConducenti(index) { var obj = document.getElementById('clienti'); eval(ajax[index].response); // Executing the response from Ajax as Javascript code } function getConducente(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 = 'conducentiselect.php?ragione_sociale='+ragione_sociale; // Specifying which file to get ajax[index].onCompletion = function(){ creaConducenti(index) }; // Specify function that will be executed after //file has been found ajax[index].runAJAX(); // Execute AJAX function } } </script>
file conducentiselectCodice PHP:<form action="" method="post">
<table>
<tr>
<td><select id="clienti" name="clienti" onchange="getConducente(this)" multiple>
<?php
$exp = mysql_query("SELECT ragione_sociale FROM clienti ORDER BY ragione_sociale;");
while($cliente=mysql_fetch_array($exp)){
print("<option value='".$cliente["ragione_sociale"]."'>".$cliente["ragione_sociale"]."</option>");
} ?>
</select>
</td>
</tr>
<tr>
<td><select id="dhtmlgoodies_city" name="dhtmlgoodies_city" multiple>
</select>
</td>
</tr>
<tr>
<td><select id="flotta" name="flotta" multiple>
<?php
$exp3 = mysql_query("SELECT * FROM flotta ORDER BY targa;");
while($flotta=mysql_fetch_array($exp3)){
print("<option value='".$flotta["targa"]."'>".$flotta["targa"]." - ".$flotta["modello"]." - ".$flotta["versione"]."</option>");
} ?>
</select>
</td>
</tr>
</table>
</form>
dov'è che sbaglio?Codice PHP:$exp2 = mysql_query("SELECT * FROM conducenti WHERE ragione_sociale = '".$_GET["ragione_sociale"]."';");
while($conducente=mysql_fetch_array($exp2)){
print("<option value='".$conducente["conducente"]."'>".$conducente["conducente"]."</option>");
}
?>

Rispondi quotando