Voila mon formulaire
<?php
require_once ('BaseDeDonnee.php');
if( isset($_POST["D1"]) )
$marque = $_POST["D1"];
if( isset($_POST["D2"]) )
$prix = $_POST["D2"];
$DB = new BaseDeDonnee();
$DB->seConnecter();
$requete ="select * from Véhicule";
if( isset($_POST["D1"]) ){ //chargement suite à l'appui sur le bouton
//Test si marque est selectionné
if( $marque != 'Marque' && $prix == 'Prix')
$requete = $requete." WHERE Marque = '".$marque."'";
//Test si prix est selectionné
if( $prix != 'Prix' && $marque == 'Marque')
$requete = $requete." WHERE Prix ".$prix;
//Test si marque et prix sont selectionné
if( $marque != 'Marque' && $prix != 'Prix')
$requete = $requete." WHERE Marque = '".$marque."' AND prix ".$prix;
}
//echo $requete;
$resultat = $DB->requete($requete);
?>
<html>
<!-- Date de création: 03/10/2005 -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Rechercher</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body><br>
<div style="text-align: center"><h1>Rechercher un Véhicule</h1>
</div>
<div style="text-align: center"> </div>
<div style="text-align: left; width:661; height:83">
<form method="POST" action="Rechercher_Vehicule.html.php">
<select size="1" name="D1">
<option>Marque</option>
<option>Renault</option>
<option>Peugeot</option>
<option>Opel</option>
<option>Bmw</option>
<option>Citroen</option>
</select>
<select size="1" name="D2">
<option>Prix</option>
<option><=5000</option>
<option>>=5000</option>
</select><input type="submit" value="Envoyer" name="B1"></p>
</form>
<table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#111111" style="border-collapse: collapse" summary="" id="AutoNumber1">
<tr>
<td align="center"><font size="2">Marque</font></td>
<td align="center"><font size="2">Type</font></td>
<td align="center"><font size="2">Modèle</font></td>
<td align="center"><font size="2">Année</font></td>
<td align="center"><font size="2">Puissance</font></td>
<td align="center"><font size="2">Energie</font></td>
<td align="center"><font size="2">Kilomètre</font></td>
<td align="center"><font size="2">Prix</font></td>
<td align="center">Photo</td>
<td align="center"><font size="2">Sélection</font></td>
</tr>
<?php
for($i=0;$i< mysql_num_rows($resultat);$i++){
$row = mysql_fetch_array($resultat);
echo "<tr>";
echo '<td align="center">'.$row[1]."</td>";
echo '<td align="center">'.$row[2]."</td>";
echo '<td align="center">'.$row[3]."</td>";
echo '<td align="center">'.$row[4]."</td>";
echo '<td align="center">'.$row[5]."</td>";
echo '<td align="center">'.$row[6]."</td>";
echo '<td align="center">'.$row[7]."</td>";
echo '<td align="center">'.$row[8]."</td>";
echo '<td align="center">'.$row[9]."</td>";
//echo '<td align="center"> </td><td align="center">
echo '</tr>';
}
?>
</table>
</div>
<p><font size="2"><input type="button" value="Ajouter au panier"></font></p>
</body>
</html>