salut les dév
je veux programmer deux boutons submit sur la meme page et bien-sur appartenant à deux FORM différents.
voilà le code mais pas de réaction et pas d'affichage ...
voilà mon code
Code php : 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 <?php // je programme l'événement lors d'un click sur boutton d'identification if(isset($_POST['valider'])){ $mp=$_POST['motpasse'] ; $login=$_POST['login'] ; connectMaBase(); $sql = 'SELECT * FROM utilisateur WHERE id="'.$login.'" and psw ="'.$mp.'"'; $req = mysql_query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error()); $trouv=false; while ($data = mysql_fetch_array($req)) { $trouv=true; } mysql_free_result ($req);*/ //On ferme sql mysql_close (); if($trouv){ header('Location:produit.html'); } } // je programme l'événement lors d'un click sur boutton de la recherche if(isset($_POST['rechercheType'])) { $codeType=$_POST['listeType']; // Connection à la base connectMaBase(); // On fait la requête $sql = 'SELECT marque FROM typeproduit where code_type ="'.$codeType.'"'; $req = mysql_query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error()); while ($data = mysql_fetch_array($req)) {echo 'je suis le roi '.$data['marque'];} mysql_free_result($req); mysql_close (); } ?>
voila les formes :
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53 <form name="athentification"> <p class="MsoNormal"><b><span style="font-size: 18pt; line-height: 114%; color: rgb(51, 102, 255);">Mon Compte</span></b><b><span style=""><o:p></o:p></span></b></p> <table class="MsoNormalTable" style="width: 89.25pt;" border="0" cellpadding="0" cellspacing="1" width="119"> <tbody> <tr style=""> <td style="padding: 0.75pt; width: 87.75pt;" width="117"> <p class="MsoNormal" style="text-align: center;" align="center"><span style=""><input name="login" value="votre pseudo" type="text"></span><span style="font-size: 12pt; line-height: 114%;"><o:p></o:p></span></p> </td> </tr> <tr style=""> <td style="padding: 0.75pt; background: white none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; width: 87.75pt;" width="117"> <p class="MsoNormal" style="text-align: center;" align="center"><span style=""><input name="motpasse" value="chawki" type="password"></span><span style="font-size: 12pt; line-height: 114%;"><o:p></o:p></span></p> </td> </tr> <tr style=""> <td style="padding: 0.75pt; width: 87.75pt;" width="117"> <p class="MsoNormal" style="text-align: center;" align="center"><span style=""><input value="Connexion" method="post" name="valider" type="submit"></span><span style="font-size: 12pt; line-height: 114%;"><o:p></o:p></span></p> </td> </tr> <tr style=""> <td style="padding: 0.75pt; width: 87.75pt;" width="117"> <p class="MsoNormal"><span class="liengris"><span style="font-size: 10pt; line-height: 114%; font-family: "Calibri","sans-serif"; color: rgb(153, 153, 153);">Nouveau membre?</span></span><span style="font-size: 12pt; line-height: 114%;"><o:p></o:p></span></p> </td> </tr> </tbody> </table> <p class="MsoNormal" style="margin-bottom: 12pt;"><b><span style=""><o:p> </o:p></span></b></p> </form>
2eme
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 <form name="rechercheTypeFORM"> <p class="MsoNormal" style="text-align: center;" align="center"><span style=""> <select name="listeType"> <?php // remplissage de la liste connectMaBase(); // On fait la requête $sql = "SELECT DISTINCT Type FROM produitfini"; $req = mysql_query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error()); // On fait une boucle pour chacune des lignes du résultat while ($row = mysql_fetch_array($req)) { // Affichage des liens print"<option value=".$row['Type'].">".$row['Type']."</option>"; } // On libère la mémoire et on ferme la connection mysql_free_result($req); mysql_close (); ?> </select> <input value=" Type" method="post" name="rechercheType" type="submit"><o:p></o:p></span></p> </form>
Partager