Je désire filtrer un ensemble avec deux ou 3 critères.
Je m'explique:
Je veux la liste des personnes dont le nom commence par ADJ ou VEI
voici mon code:
Code : Tout sélectionner
<a href="newabs.php">Revenir à la page des modifications globales</a>
<form action="newabs.php" method="post"><br>
<input type="text" onFocus="motclef.style.backgroundColor='yellow'"
onBlur="motclef.style.backgroundColor='white'" name="motclef" value="<?php echo $_REQUEST['$motclef1%']; ?>">
<input type="text" onFocus="motclef.style.backgroundColor='yellow'"
onBlur="motclef.style.backgroundColor='white'" name="motclef" value="<?php echo $_REQUEST['$motclef2%']; ?>">
<input type="submit" value="1) Rechercher un élève par le nom (ou tapez les 3 premières lettres), par le numéro de l'absence ou par la classe OU cliquez sur ce bouton pour avoir TOUS les élèves"><br>
</form>
<table border="1">
<tr>
<td width=''>NOM</td>
<td width=''>PRENOM</td>
<td width=''>CLASSE</td>
<td width=''>JUSTIFICATION</td>
<td width=''>Justifiée & légitime ?</td>
<td width=''><b>Quand</b></td>
<td width=''>de</td>
<td width=''>A</td>
<td width=''>Total</td>
<td width=''>Numéro</td>
</tr>
<?php
if (isset($motclef1) or isset($motclef2) )
{
$dateencours=$motclef1;
$clause = " WHERE elenom like '$motclef1%' or elenom like '$motclef2%' or elenom like '$motclef1%' or Numero like '$motclef1%' or divcod like '$motclef1%' ";
}
$orderby = " ORDER BY elenom";
$sql = "SELECT * FROM ges_abs " . $clause . $orderby;
$resultat = mysql_query ($sql);
echo $sql;
echo '';
while ($eleve = mysql_fetch_array ($resultat))
{
suite du code bien sûr......
comment avoir sur les deux noms par ex ? en espérant être clair....
merci