| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 
 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
 
	<head>
 
    </head>
 
	<body>
 
 
<form method="post" action="">
 
  <p>Circuit: <br/>
  <input type="radio" name="circuit" value="australie" checked="checked" /> chine<br/>
  <input type="radio" name="circuit" value="malaisie" /> malaisie<br/>
  <input type="radio" name="circuit" value="chine" /> chine<br/>
  <p><br/>
  </p>
  <p>
    <input type="submit" value="envoyer"/>
    <input type="reset" value="recommencer"/>
  </p>
</form>
 
 
<?php
if (isset ($_POST['circuit']))
{
	echo "Le circuit est : ";
	echo $_POST ["circuit"];
	echo '<br />' ;
}
 
$circuit=$_POST ['circuit']; //j'aimerais transferer ce qui est cocher vers la variable $circuit.
 
?>
 
		<?php
mysql_connect("localhost", "root", ""); // Connexion à MySQL
mysql_select_db("classement"); // Sélection de la base coursphp
 
 
$select = "select *
from pilotes p
inner join gagnant g using (id_pilote)
inner join circuit c using (id_circuit)
where nom = "$circuit";"; //j'aimerais utiliser $circuit dans ma requete sql.
 
 
$result = mysql_query($select) or die ('Erreur : '.mysql_error() );
$total = mysql_num_rows($result);
$test=0;
 
// On fait une boucle pour lister tout ce que contient la table :
 
 
 
if($total) {
    // debut du tableau
    echo '<table bgcolor="#FFFFFF">'."\n";
        // première ligne on affiche les titres prénom et surnom dans 2 colonnes
        echo '<tr>';
		echo '<td bgcolor="#669999"><b><u>Position</u></b></td>';
        echo '<td bgcolor="#669999"><b><u>Prenom</u></b></td>';
        echo '<td bgcolor="#669999"><b><u>Nom</u></b></td>';
      echo '</tr>'."\n";
    // lecture et affichage des résultats sur 2 colonnes, 1 résultat par ligne.    
    while($row = mysql_fetch_array($result)) {
	 $test++;
        echo '<tr>';
		echo '<td bgcolor="#CCCCCC">'.$test.'</td>';
        echo '<td bgcolor="#CCCCCC">'.$row["prenom_pilote"].'</td>';
        echo '<td bgcolor="#CCCCCC">'.$row["nom_pilote"].'</td>';
      echo '</tr>'."\n";
 
    }
    echo '</table>'."\n";
    // fin du tableau.
}
else echo 'Pas d\'enregistrements dans cette table...';
 
 
?>		
	</body>
</html> |