bonjour truc,
bon alors je t'explique j'ai mon formulaire de recherche qui s'appelle index.php et j'ai 2 <select> 1 pour les annonceurs et 1 autre pour les clients, mais je ne fait pas le traitement du formulaire sur la meme page (du moins par pour le moment !!!! plus tard peut etre ???), J'ai une seule et unique table contenant les annonceurs et les clients et tout le reste.....
Je te mets le code ci dessous de ma page index.php:
<form action="recherche.php" method="post">
<?
include("_connexion.php");
?>
<?
$req = "SELECT annonceur, client FROM commandes_2005";
$res = mysql_query($req) or die;
$nbl = mysql_num_rows($res);
$query = "SELECT DISTINCT annonceur FROM commandes_2005 ORDER BY annonceur ASC";
$result = mysql_query($query);
?>
<table width="600" border="0" cellspacing="2" cellpadding="4" align="center"></p>
<tr>
<td width="100%"> <table width="153" border="1" bgcolor="#666666" cellpadding="0" cellspacing="0">
<tr>
<td width="172"><strong><font color="#FFFFFF">Moteur de recherche</font></strong></td>
</tr>
</table>
<table width="100%" height="22" border="1" cellpadding="2" cellspacing="0" class="body">
<tr align="center" valign="middle" bordercolor="#999999" bgcolor="#cdd3fd">
<td width="4%" class="bez"><font color="#000000">Annonceur </font></td>
<td width="4%" bgcolor="#cdd3fd" class="bez"><form name="annonceur" method="post"
action="<? echo $URL; ?>">
<select name="annonceur" size="1">
<option value="tous">Tous</option>
<? while ($val = mysql_fetch_array($result)) { ?>
<option><? echo $val["annonceur"]; ?></option>
<? } ?>
</select></td>
<td width="4%" bgcolor="#cdd3fd" class="bez"><font color="#000000">Client</font></td>
<td width="6%" bgcolor="#cdd3fd" class="bez"> <? $URL = $PHP_SELF;
$query = "SELECT DISTINCT client FROM commandes_2005 ORDER BY client ASC";
$result1 = mysql_query($query);
?>
<form name="client" method="post"
action="<? echo $URL; ?>">
<select name="client" size="1">
<option value="tous">Tous</option>
<? while ($val = mysql_fetch_array($result1)) { ?>
<option><? echo $val["client"]; ?></option>
<? } ?>
</select>
</tr>
<? mysql_close(); ?></td>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
</table>
<table width="100%" border="0">
<tr>
<td><div align="right">
<input type="submit" name="Submit" value="Envoyer">
</div></td>
</tr>
</table>
<form name="form1" method="post" action="">
</form>
et ensuite j'ai le fichier appelé par le formulaire de recherche qui s'appelle recherche.php et que je te mets avec le tableau et tous et tous.... et qui lui est composé de 7 colonnes ou figure les annonceurs, les clients ainsi que nom,telephone,fax,commercial,portable, je te mets le code ci dessous:
<?
include("_connexion.php");
$req = 'SELECT DISTINCT annonceur,client FROM commandes_2005 WHERE 1 = 1';
if ($annonceur!="tous")
$req.= " AND annonceur ='".$annonceur."'";
if ($client!="tous")
$req.= " AND client ='".$client."'";
$req.= " ORDER BY annonceur ASC";
$res = mysql_query($req) or die;
$nbl = mysql_num_rows($res);
$req2 ="SELECT nom,telephone,fax,commercial,portable FROM commandes_2005";
$req2.= " ORDER BY annonceur ASC";
$res2 = mysql_query($req2) or die;
$nbl2 = mysql_num_rows($res2);
?>
<table width="78%" border="0">
<tr>
<td width="36%"><strong><a href="enregistrement.php?var=tous"> </a><u><a href="enregistrement.php?var=tous">Nombre
d'enregistrement dans la base:</a></u></strong></td>
<td width='64%'><font color="#000000"><div align='left'><B><?php echo($nbl); ?></B></div></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="2" cellspacing="0" class="frame">
<td width="30%" valign="top"> <table width="100%" height="22" border="1" cellpadding="2" cellspacing="0" class="body">
<tr align="center" valign="middle" bordercolor="#999999" bgcolor="#666666">
<td class="bez"><font color="#FFFFFF">Annonceur </font></td>
<td class="bez"><font color="#FFFFFF">Client</font></td>
<td class="bez"><font color="#FFFFFF">Nom</font></td>
<td bgcolor="#666666" class="bez"><font color="#FFFFFF">Telephone</font></td>
<td class="bez"><font color="#FFFFFF">Fax</font></td>
<td class="bez"><font color="#FFFFFF">Commercial</font></td>
<td class="bez"><font color="#FFFFFF">Portable</font></td>
</TR>
<?
$i=0;
while ($nbl!=$i)
{
$annonceur = mysql_result($res,$i,"annonceur");
$client = mysql_result($res,$i,"client");
$nom = mysql_result($res2,$i,"nom");
$telephone = mysql_result($res2,$i,"telephone");
$fax = mysql_result($res2,$i,"fax");
$commercial = mysql_result($res2,$i,"commercial");
$portable = mysql_result($res2,$i,"portable");
?>
<tr align="center" valign="middle" bordercolor="#999999" bgcolor="cdd3fd">
<td class="bez"><font color="#000000"><a href="annonceur.php"><?php echo($annonceur); ?></font></td>
<td class="bez"><font color="#000000"><?php echo($client); ?></font></td>
<td class="bez"><font color="#000000"><?php echo($nom); ?></font></td>
<td class="bez"><font color="#000000"><?php echo($telephone); ?></font></td>
<td class="bez"><font color="#000000"><?php echo ereg_replace(" ", "", $fax); ?></font></td>
<td class="bez"><font color="#000000"><?php echo($commercial); ?></font></td>
<td class="bez"><font color="#000000"><?php echo ereg_replace(" ", "", $portable); ?></font></td>
<?
$i++;
}
echo "</table></TR>";
mysql_close();
?>
voilà je crois que tu as tous truc, je pense que tous mon code n'est pas trop academique mais il marche, maintenant si il y a des modifications à faire pour qu'il marche mieux n'hesite pas à me les transmettre se sera avec plaisir.
En esperant avoir repondu à toutes tes questions et si tu en as d'autres n'hesite surtout pas.
En tout cas merci beaucoup de t'interresser à mon probleme, en esperant qu'avec HD vous allez reussir à trouver comment faire pour que les annonceurs et les clients coincident avec les nom,telephone,fax,commercial,portable,.
@++