Voilà j'ai un souci de requête. La suivante fonctionne bien, je fais une recherche sur 3 listes déroulantes à partir de la même table, tb_evenements (avec les champs, id_evenement, date, ville, departement)
<form name="form1" method="post" action="resultat.php">
Période
<select name="num_mois" id="select1">
<option value="1">Janvier</option>
<option value="2">Février</option>
<option value="3">Mars</option>
<option value="4">Avril
<option value="5">Mai</option>
<option value="6">Juin</option>
<option value="7">Juillet</option>
<option value="8">Août</option>
<option value="9">Septembre</option>
<option value="10">Octobre</option>
<option value="11">Novembre</option>
<option value="12">Décembre</option>
</select>
Département
<select name="departement2" id="select2">
<?php
do {
?>
<option value="<?php echo $row_rs2departement['departement']?>"><?php echo $row_rs2departement['departement']?></option>
<?php
} while ($row_rs2departement = mysql_fetch_assoc($rs2departement));
$rows = mysql_num_rows($rs2departement);
if($rows > 0) {
mysql_data_seek($rs2departement, 0);
$row_rs2departement = mysql_fetch_assoc($rs2departement);
}
?>
</select>
Thème
<select name="evenement2" id="evenement2">
<option value="">Tous les événements</option>
<?php
while ($row_rs2evenement = mysql_fetch_assoc($rs2evenement)) {
?>
<option><?php echo $row_rs2evenement['evenement']?></option>
<?php
}
?>
</select>
<input type="submit" name="Submit2" value="Envoyer">
</form>
<form name="form3" method="post" action="">
</form>
</td>
</tr>
</table>
<table width="600" height="103" border="0" align="center" cellspacing="3">
<tr>
<td height="103" colspan="2" bgcolor="#FFFFFF">
<p align="center"> </p>
<form name="form2" method="post" action="resultatslocations.php">
<p>Département
<select name="departement" id="departement" title="<?php echo $row_rsdepartement['departement']; ?>">
<?php
do {
?>
<option value="<?php echo $row_rsdepartement['departement']?>"><?php echo $row_rsdepartement['departement']?></option>
<?php
} while ($row_rsdepartement = mysql_fetch_assoc($rsdepartement));
$rows = mysql_num_rows($rsdepartement);
if($rows > 0) {
mysql_data_seek($rsdepartement, 0);
$row_rsdepartement = mysql_fetch_assoc($rsdepartement);
}
?>
</select>
Type
<select name="type" id="select3" title="<?php echo $row_rstype['type']; ?>">
<?php
do {
?>
<option value="<?php echo $row_rstype['type']?>"><?php echo $row_rstype['type']?></option>
<?php
} while ($row_rstype = mysql_fetch_assoc($rstype));
$rows = mysql_num_rows($rstype);
if($rows > 0) {
mysql_data_seek($rstype, 0);
$row_rstype = mysql_fetch_assoc($rstype);
}
?>
</select>
Catégorie
<select name="categorie" id="select4" title="<?php echo $row_rscategorie['categorie']; ?>">
<?php
do {
?>
<option value="<?php echo $row_rscategorie['categorie']?>"><?php echo $row_rscategorie['categorie']?></option>
<?php
} while ($row_rscategorie = mysql_fetch_assoc($rscategorie));
$rows = mysql_num_rows($rscategorie);
if($rows > 0) {
mysql_data_seek($rscategorie, 0);
$row_rscategorie = mysql_fetch_assoc($rscategorie);
}
?>
</select>
<input type="submit" name="Submit" value="Rechercher">
</p>
</form>
Mais je voudrais aussi afficher en fonction du département sélectionné les découvertes qui se trouvent sur une autre table. tb_decouvertes, id_decouverte, decouvertes, ville, departementJe n'ai pas fait de clé étrangère sur le champ département car il paraît que phpMyAdmin n'en tient pas compte !
Donc si vous pouviez m'aidez encore cette fois-ci ça serait très sympa ! J'ai déjà cherché mais je ne m'embrouille avec tout ce code !
Encore merci d'avance !