Précédent   Forum des professionnels en informatique > PHP > Langage > Formulaires
Formulaires Forum d'entraide sur les formulaires avec PHP. Avant de poster -> FAQ formulaires, Cours de formulaires et Sources de formulaires
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 03/05/2011, 11h13   #1
 
Femme noura wafi
Étudiant
Inscription : avril 2011
Messages : 12
Détails du profil
Informations personnelles :
Nom : Femme noura wafi
Localisation : Tunisie

Informations professionnelles :
Activité : Étudiant
Secteur : Conseil

Informations forums :
Inscription : avril 2011
Messages : 12
Points : -5
Points : -5
Par défaut recherche en php5

bonjour,
je suie vraiment une grande probléme mon code php5 n'accepte pas la fonction POST et voici mon code:
Code :
1
2
3
4
5
6
7
8
9
10
 
public function recherchedecircuit()
{    
$y=$_POST['id_circuit'];
$requete ="select * from circuit where id_circuit LIKE '%".$y."%';";
if($result =mysql_query($requete))
{ 
$row=mysql_fetch_row($result);
}
echo $row[0];
mais il m'affiche toujours la faute suivante:
Notice: Undefined index: id_circuit in D:\EasyPHP-5.3.3\www\pfe\afficheridcircuit.php on line 2
babamama est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/05/2011, 11h16   #2
Expert Confirmé Sénior
 
Homme Laurent Willems
Expert Stop/Start
Inscription : septembre 2002
Messages : 2 549
Détails du profil
Informations personnelles :
Nom : Homme Laurent Willems
Âge : 33
Localisation : Belgique

Informations professionnelles :
Activité : Expert Stop/Start

Informations forums :
Inscription : septembre 2002
Messages : 2 549
Points : 4 269
Points : 4 269
Salut,

Es-tu sûre que ton formulaire possède bien un champ id_circuit? pas de faute de frappe? Peux-tu montrer le code de ton formulaire?
__________________
Alea Jacta Test!
Mygale1978 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/05/2011, 11h34   #3
 
Femme noura wafi
Étudiant
Inscription : avril 2011
Messages : 12
Détails du profil
Informations personnelles :
Nom : Femme noura wafi
Localisation : Tunisie

Informations professionnelles :
Activité : Étudiant
Secteur : Conseil

Informations forums :
Inscription : avril 2011
Messages : 12
Points : -5
Points : -5
oui j'ai un champ de nom id_circuit et voici le code:
Code :
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
 
<table width='100%' height='500'>
					<center>
						<tr>
						<td>
						<font color='white'>id_circuit:</font>
						</td>
						<td>
						<input name='id_circuit' type='text' value=$row[0] >
						</td>
						</tr>
						<tr>
						<td>
						<font color='white'>Nom circuit</font>
						</td>
						<td>
						<input name='Nomcircuit' type='text' value= $row[1] >
						</td>
						</tr>
						 <tr>
						  <td>
						    <font color='white'>Ville de départ:</font>
						  </td>
						  <td>
						    <input name='Villededépart' type='text'  value=$row[2]>
						  </td>
						 </tr>
						 <tr>
							<td>
								<font color='white'>Jour de départ:</font>
						    </td>
						    <td>
								 <input name='Jourdedépart' type='text' value=$row[3] >
						    </td>
						 </tr>
 
						 <tr>
							 <td>
								 <font color='white'>Jour de retour:</font>
						     </td>
						     <td>
								 <input name='Jourderetour' type='text' value=$row[4] >
						     </td>
						 </tr>
						 <tr>
						     <td>
						         <font color='white'>Durée:</font>
						     </td>
						     <td>
						         <input name='Durée' type='text' value=$row[5] >
						     </td>
						 </tr>
						 <tr>
						     <td>
						         <font color='white'>Prix:</font>
						     </td>
						     <td>
						         <input name='Prix' type='text' value=$row[6] >
						     </td>
						 </tr>
						 <tr>
						     <td>
						         <font color='white'>Supplement Single:</font>
						     </td>
						     <td>
						         <input name='Supplementsingle' type='text' value=$row[7] >
						     </td>
						 </tr>
						 <tr>
						     <td>
						         <font color='white'>Reduction enfant:</font>
						     </td>
						     <td>
						         <input name='Reductionenfant' type='text' value=$row[8] >
							 </td>
						 </tr>
						 <tr>
						     <td>
								 <font color=white>Description:</font>
							 </td>
						     <td>
 
							 <textarea rows=10 cols=17 name='Description' value=$row[9] ></textarea> 
 
						     </td>
						 </tr>
						 <tr>
					         <td>
						     </td>
						     <td>
						     </td>
						 <tr>
						     <td>
							     <a href='ajouter.html'><img src='précédent1.jpg' width='80'height='80'></a>
						     </td>
						     <td>
						  <center>
						  <a href='admini.html'><img src='accueil.jpg' width='80' height='80'></a>
						  </center>
						  </td>
					    <td>
						 <a href='sauvegardercircuit.php'><img src='sauvegarde.jpg' width='100' height='100'></a>
						</td>
					</tr>
					</center>
			</table>
babamama est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/05/2011, 11h36   #4
Expert Confirmé Sénior
 
Homme Laurent Willems
Expert Stop/Start
Inscription : septembre 2002
Messages : 2 549
Détails du profil
Informations personnelles :
Nom : Homme Laurent Willems
Âge : 33
Localisation : Belgique

Informations professionnelles :
Activité : Expert Stop/Start

Informations forums :
Inscription : septembre 2002
Messages : 2 549
Points : 4 269
Points : 4 269
où est la balise form?

Peux-tu montrer l'entiereté de tes fichiers stp. Sinon tu peux toujours fournir les fichiers concernés en pièce jointe
__________________
Alea Jacta Test!
Mygale1978 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/05/2011, 11h58   #5
 
Femme noura wafi
Étudiant
Inscription : avril 2011
Messages : 12
Détails du profil
Informations personnelles :
Nom : Femme noura wafi
Localisation : Tunisie

Informations professionnelles :
Activité : Étudiant
Secteur : Conseil

Informations forums :
Inscription : avril 2011
Messages : 12
Points : -5
Points : -5
j'ai la premiére fichier circuitrechercher.php pour faire entrer le id_circuit que je le veux en utilisant le code suivant:
Code :
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
<html>
	<head>
		<title>circuit2</title>
	</head>
		<body bgcolor="black"><center>
			<table background="image2.jpg" width="800" height="800">
				<tr width="100" height="100">
					<td>
					</td>
					<img src="man.jpg" width="200" height="100">
						<form name="form1" action="ajouter.html">
							<button type="button1"><img src="ajouter.jpg" width=100 height=100></button></form>
						<form name="form2" action="modification.html">
							<button type="button2"><img src="modifier.jpg" width=100 height=100></button></form>
						<form name="form3" action="suppression.html">
							<button type="button3"><img src="supprimer.jpg" width=100 height=100></button></form>
					<img src="8.jpg" width="200" height="100">
					<td>
					</td>
				</tr>
				<tr>
				<td></td>
				<td><center>
 
				<font color="white">id_circuit:</font>
				<input name="id_circuit" type="text"><br></center></td>
				<td>
				<a href="cherchercircuit.php"><img src="chercher.jpg" width="100" height="100"></a>
				</td>
				<td></td>
				</tr>
				<tr>
				  <td>
				    <a href="modification.html"><img src="précédent1.jpg" width="80" height="80"></a>
				  </td>
				  <td>
				    <a href="admini.html"><img src="accueil.jpg" width="80" height="80"></a>
				  </td>
				  <td>
				  </td>
				</tr>
			</table>
		</body>
</html>
la deuxiéme fichier cherchercircuit.php permet d'afficher tous les données à partir de la base des données mysql dans la formulaire et le code utilisé est le suivant:
Code :
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
 
<html>
	<head>
	<title>Circuit</title>
	</head>
		<body bgcolor="black">
		<center>
		<table background="image2.jpg" width="800" height="800">
				<tr width="100" height="100">
					<td>
					</td>
 
					<img src="man.jpg" width="200" height="100">
						<form name="form1" action="ajouter.html">
							<button type="button1"><img src="ajouter.jpg" width=100 height=100></button></form>
						<form name="form2" action="modification.html">
							<button type="button2"><img src="modifier.jpg" width=100 height=100></button></form>
						<form name="form3" action="suppression.html">
							<button type="button3"><img src="supprimer.jpg" width=100 height=100></button></form>
					<img src="8.jpg" width="200" height="100">
					</td>
					<td>
					</td>
				</tr>
				<tr>
				<td>
				</td>
				<td>
				 <?php 
					 include("recherchedecircuit.php");
					 $obj=new circuit();
					 $obj->recherchedecircuit();
					 ?>
				</td>
				<td>
				</td>
				</table></center>
 
 
 
 
		</body>
	</html>
il m'affiche les données de la premiére ligne avec la faute suivante:
Notice: Undefined index: id_circuit in D:\EasyPHP-5.3.3\www\pfe\recherchedecircuit.php on line 31
et la fichier qui contient tous la fonction de recherche qui s'appelle recherchecircuit.php en utilisant le code suivant:
Code :
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
 
<?php
require_once("connexion.php");
class circuit{
public $id_circuit;
public $Nomcircuit;
public $Villededepart;
public $Jourdedepart;
public $Jourderetour;
public $Duree;
public $Prix;
public $Supplementsingle;
public $Reductionenfant;
public $Description;
public function recherchedecircuit()
	{    $y =$_POST['id_circuit'];
			$requete ="select * from circuit where id_circuit LIKE '%".$y."%';";
			if($result =mysql_query($requete))
			{ $row=mysql_fetch_row($result);
 
			echo "<table width='100%' height='500'>
					<center>
						<tr>
						<td>
						<font color='white'>id_circuit:</font>
						</td>
						<td>
						<input name='id_circuit' type='text' value=$row[0] >
						</td>
						</tr>
						<tr>
						<td>
						<font color='white'>Nom circuit</font>
						</td>
						<td>
						<input name='Nomcircuit' type='text' value= $row[1] >
						</td>
						</tr>
						 <tr>
						  <td>
						    <font color='white'>Ville de départ:</font>
						  </td>
						  <td>
						    <input name='Villededépart' type='text'  value=$row[2]>
						  </td>
						 </tr>
						 <tr>
							<td>
								<font color='white'>Jour de départ:</font>
						    </td>
						    <td>
								 <input name='Jourdedépart' type='text' value=$row[3] >
						    </td>
						 </tr>
 
						 <tr>
							 <td>
								 <font color='white'>Jour de retour:</font>
						     </td>
						     <td>
								 <input name='Jourderetour' type='text' value=$row[4] >
						     </td>
						 </tr>
						 <tr>
						     <td>
						         <font color='white'>Durée:</font>
						     </td>
						     <td>
						         <input name='Durée' type='text' value=$row[5] >
						     </td>
						 </tr>
						 <tr>
						     <td>
						         <font color='white'>Prix:</font>
						     </td>
						     <td>
						         <input name='Prix' type='text' value=$row[6] >
						     </td>
						 </tr>
						 <tr>
						     <td>
						         <font color='white'>Supplement Single:</font>
						     </td>
						     <td>
						         <input name='Supplementsingle' type='text' value=$row[7] >
						     </td>
						 </tr>
						 <tr>
						     <td>
						         <font color='white'>Reduction enfant:</font>
						     </td>
						     <td>
						         <input name='Reductionenfant' type='text' value=$row[8] >
							 </td>
						 </tr>
						 <tr>
						     <td>
								 <font color=white>Description:</font>
							 </td>
						     <td>
 
							 <textarea rows=10 cols=17 name='Description' value=$row[9] ></textarea> 
 
						     </td>
						 </tr>
						 <tr>
					         <td>
						     </td>
						     <td>
						     </td>
						 <tr>
						     <td>
							     <a href='ajouter.html'><img src='précédent1.jpg' width='80'height='80'></a>
						     </td>
						     <td>
						  <center>
						  <a href='admini.html'><img src='accueil.jpg' width='80' height='80'></a>
						  </center>
						  </td>
					    <td>
						 <a href='sauvegardercircuit.php'><img src='sauvegarde.jpg' width='100' height='100'></a>
						</td>
					</tr>
					</center>
			</table>";
 
	    }}
?>
babamama est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/05/2011, 22h01   #6
Modérateur
 
Avatar de sabotage
 
Homme Vincent
Inscription : juillet 2005
Messages : 14 929
Détails du profil
Informations personnelles :
Nom : Homme Vincent

Informations forums :
Inscription : juillet 2005
Messages : 14 929
Points : 16 381
Points : 16 381
Avant d'utiliser $_POST['id_circuit'] il faut verifier s'il existe avec isset().
sabotage est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/05/2011, 22h10   #7
Membre émérite
 
Avatar de vorace
 
Homme
Développeur
Inscription : août 2010
Messages : 587
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France, Meurthe et Moselle (Lorraine)

Informations professionnelles :
Activité : Développeur

Informations forums :
Inscription : août 2010
Messages : 587
Points : 861
Points : 861
et même en testant si il existe c'est une faute de conception que de mettre $_POST dans une fonction plutôt que de le passer en paramètre...
en plus une fonction qui prends pas de paramètre et qui retourne rien, c'est plus une procédure qu'une fonction, limite y a même pas besoin d'une fonction pour ça un simple script à la suite de ton code suffit...
en plus une classe sans constructeur qui à qu'une fonction qui écrie du HTML...?!
en revoyant toute les discussions que tu as ouverte, j'ai envie de te dire relis tes cours...
__________________
Développeur informatique contrarié...
vorace est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/05/2011, 22h19   #8
 
Femme noura wafi
Étudiant
Inscription : avril 2011
Messages : 12
Détails du profil
Informations personnelles :
Nom : Femme noura wafi
Localisation : Tunisie

Informations professionnelles :
Activité : Étudiant
Secteur : Conseil

Informations forums :
Inscription : avril 2011
Messages : 12
Points : -5
Points : -5
lorsque j'utilise la finction isset() il ne m'affiche rien.
Code :
if(isset($_POST['id_circuit']))
babamama est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/05/2011, 22h27   #9
Membre émérite
 
Avatar de vorace
 
Homme
Développeur
Inscription : août 2010
Messages : 587
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France, Meurthe et Moselle (Lorraine)

Informations professionnelles :
Activité : Développeur

Informations forums :
Inscription : août 2010
Messages : 587
Points : 861
Points : 861
dans ce cas, le problème est résolu...
__________________
Développeur informatique contrarié...
vorace est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/05/2011, 22h28   #10
Modérateur
 
Avatar de sabotage
 
Homme Vincent
Inscription : juillet 2005
Messages : 14 929
Détails du profil
Informations personnelles :
Nom : Homme Vincent

Informations forums :
Inscription : juillet 2005
Messages : 14 929
Points : 16 381
Points : 16 381
Ou est le formulaire qui envoit ce "id_circuit" ?
sabotage est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/05/2011, 22h37   #11
Membre émérite
 
Avatar de vorace
 
Homme
Développeur
Inscription : août 2010
Messages : 587
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France, Meurthe et Moselle (Lorraine)

Informations professionnelles :
Activité : Développeur

Informations forums :
Inscription : août 2010
Messages : 587
Points : 861
Points : 861
Citation:
Envoyé par sabotage Voir le message
Ou est le formulaire qui envoit ce "id_circuit" ?
regarde bien le code, dans la classe qui fait appel à $_POST['id_circuit'] elle même, c'est une aberration ce code...
je le redis revoies tes cours...
__________________
Développeur informatique contrarié...
vorace est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/05/2011, 22h39   #12
Modérateur
 
Avatar de sabotage
 
Homme Vincent
Inscription : juillet 2005
Messages : 14 929
Détails du profil
Informations personnelles :
Nom : Homme Vincent

Informations forums :
Inscription : juillet 2005
Messages : 14 929
Points : 16 381
Points : 16 381
Non justement il n'y a que des champs dans la class, pas le formulaire.
Dans le reste du code, il y a pléthore de formulaire mais je n'en vois pas avec ce champs.
sabotage est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/05/2011, 22h49   #13
Membre émérite
 
Avatar de vorace
 
Homme
Développeur
Inscription : août 2010
Messages : 587
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France, Meurthe et Moselle (Lorraine)

Informations professionnelles :
Activité : Développeur

Informations forums :
Inscription : août 2010
Messages : 587
Points : 861
Points : 861
y en à un autre dans le premier fichier :
Code :
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
<html>
	<head>
		<title>circuit2</title>
	</head>
		<body bgcolor="black"><center>
			<table background="image2.jpg" width="800" height="800">
				<tr width="100" height="100">
					<td>
					</td>
					<img src="man.jpg" width="200" height="100">
						<form name="form1" action="ajouter.html">
							<button type="button1"><img src="ajouter.jpg" width=100 height=100></button></form>
						<form name="form2" action="modification.html">
							<button type="button2"><img src="modifier.jpg" width=100 height=100></button></form>
						<form name="form3" action="suppression.html">
							<button type="button3"><img src="supprimer.jpg" width=100 height=100></button></form>
					<img src="8.jpg" width="200" height="100">
					<td>
					</td>
				</tr>
				<tr>
				<td></td>
				<td><center>
				
				<font color="white">id_circuit:</font>
				<input name="id_circuit" type="text">// il est la !!!
<br></center></td>
				<td>
				<a href="cherchercircuit.php"><img src="chercher.jpg" width="100" height="100"></a>
				</td>
				<td></td>
				</tr>
				<tr>
				  <td>
				    <a href="modification.html"><img src="précédent1.jpg" width="80" height="80"></a>
				  </td>
				  <td>
				    <a href="admini.html"><img src="accueil.jpg" width="80" height="80"></a>
				  </td>
				  <td>
				  </td>
				</tr>
			</table>
		</body>
</html>
mais toujours en dehors d'un formulaire...
__________________
Développeur informatique contrarié...
vorace est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 07h33.


 
 
 
 
Partenaires

Hébergement Web