Puoi fare cosi..... Cioè ricaricando la pagina html dopo ogni selezione.
Non ho testato ma l'idea c'è. In poche parole metto in una select tutte le categorie e seleziono gli utenti in base alla categoria.
Do' x scontato che la connessione al DB sia già fatta.
codice:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled</title> </head> <body> <? //--------- Categoria $idcat = "none"; if (isset($_GET['idcat'])) { $idcat = $_GET['idcat']; } // if (isset($_GET['idcat'])) //-------- Query della categoria $queryCat = "select idcategoria, categoria from tabella order by categoria"; $resCat = mysql_query($queryCat); //-------- Query utenti della categoria if ($idcat != "none") { $querySotCat = "select id_utente, nome_utente, cognome_utente frol tabutente where idcategoria = '$idcat'"; $resSotCat = mysql_query($querySotCat); } ?> <form id="f1" action="questa_pagina.php" method="post"> <select name="idcat" onchange="document.getElementById('f1').submit()"> <option value="none">Seleziona una categoria</option><? while (list($idcategoria, $categoria) = mysql_fetch_array($resCat) { $selected = $idcat == $idcategoria ? "selected" : "";?> <option value="<? print $idcategoria ?>" <? print $selected ?>><? print $categoria ?></option><? } ?> </select> </form><? if ($idutente != "none") {?> <select name="idutente"><? while (list($id_utente, $nome_utente, $cognome_utente) = mysql_fetch_array($resSotCat) {?> <option value="<? print $id_utente ?>"><? print "$cognome_utente $cognome_utente"?></option><? } ?> </select><? } ?> </body> </html>

Rispondi quotando