Bonjour, j'ai pu utiliser une variable issus d'un formulaire ds unr requete mais j'arrive pas a combiner plusieurs variables issus d'un formulaire dans une meme requete !
voila ce que je fais :
Code html : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
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 <html> <body> <font color=blue><h2 align=center><u>Veuillez déterminer les critères de recherche !</h2></u></font> <form action="recherche.php" method="POST"> <table> <tr> <td>Critère :</td> <td> <select name="choix1" > <option value="valopt1">Age</option> <option value="valopt2">Moyenne</option> </select></td> <td> Opérateurs : </td> <td><select name="choix2" > <option value="valop1"><</option> <option value="valop2">!=</option> </select></td> <td> Valeur :</td> <td> <input type=text name="valeur"> </td> </tr> <tr><td></td> <td></td> <td></td> <td></td><td></td><td></td><td></td> <td><input type=submit name="Valider" value="Rechercher"></td> </table> </form> </body> </html>
et le deuxieme :
et merci d'avance.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
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 <html> <body> <font color=blue><h2 align=center><u>Résultat !</h2></u></font> <CENTER> <table border=1> <tr> <th>Nom</th> <th>Prenom</th> <th>CNE</th> <th>AGE</th> <th>MOYENNE</th> </tr> <? if (mysql_connect("localhost","root","")>0) echo""; else echo "connexion impossible "; if(mysql_select_db("ensas")==true) echo "<br> "; else "selection de la base impossible "; $choix1=$_POST['choix1']; $choix2=$_POST['choix2']; $valeur=$_POST['valeur']; $requete="SELECT* FROM g_info where $choix1 $choix2 $valeur"; //c'est la ou j'ai le probleme $result=mysql_query($requete); do { ?> <tr> <td><? echo $enreg['NOM']; ?></td> <td><? echo $enreg['PRENOM']; ?></td> <td><? echo $enreg['CNE']; ?></td> <td><? echo $enreg['Age']; ?></td> <td><? echo $enreg['Moyenne']; ?></td> </tr> <? }while($enreg=mysql_fetch_array($result)); ?> </table> </center> </body> </html>
Partager