E' un po' disordinato a causa delle varie prove:
Codice PHP:
<form action="visualizzazione_giocatori2.php" method="get">
<?php
//primo menu a tendina
$query="select squadra from nazionale";
$ris1=mysql_query($query);
echo('
Selezionare la nazionale di cui visualizzare i giocatori:
');
echo('<select name="squadra">');
echo('<option value="">NAZIONALE</option>');
while($row1=mysql_fetch_array($ris1)){
echo('<option value="'.$row1['squadra'].'">'.$row1['squadra'].'</option>');}
echo('</select>');
//secondo menu a tendina
$query2="select distinct posizione from giocatore";
$ris2=mysql_query($query2);
echo('
Selezionare la posizione di cui visualizzare i giocatori:
');
echo('<select name="posizione">');
echo('<option value="">POSIZIONE</option>');
while($row2=mysql_fetch_array($ris2)){
echo('<option value="'.$row2['posizione'].'">'.$row2['posizione'].'</option>');}
echo('</select>');
?>
<input type="submit" value="invia">
</form>
<?php
if (isset($_GET['squadra']) && isset($GET['posizione'])){
$nome=$_GET['squadra']; $posizione=$_GET['posizione'];
//query per la selezione dei giocatori
$query0="select * from giocatore g where g.squadra_nazionale='$nome' and g.posizione='$posizione'";
$ris0=mysql_query($query0);
echo mysql_error();
while($row=mysql_fetch_array($ris0)){
//stampa dei giocatori
?>
<table class="class" border="2" bordercolor="#0066CC">
<tr>
<td>[img]<?php echo($row['foto'])?>[/img]</td>
<td>
Numero: <?php echo($row['numero']) ?>
Nome: <?php echo($row['nome']) ?>
Cognome: <?php echo($row['cognome']) ?>
Data di Nascita: <?php echo($row['data_nascita']) ?>
Posizione: <?php echo($row['posizione']) ?>
Club: <?php echo($row['club']) ?>
Altezza (cm): <?php echo($row['altezza']) ?>
Peso (kg): <?php echo($row['peso']) ?>
Nazionale: <?php echo($row['squadra_nazionale']) ?>
</td>
</table>
<?php }}
?>