Précédent   Forum des professionnels en informatique > PHP > Langage
Langage Forum sur le langage PHP, la POO, les conventions, la sécurité, etc. Avant de poster : FAQ Langage, toutes les FAQ PHP, cours langage et sources PHP
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 29/04/2011, 18h10   #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 sélection du base mysql

bonjour ,je veux entrer un id_circuit dans un formulaire puis quand je fais un clique sur button rechercher m'affiche dans un autre formulaire les données correspond à ce id_circuit.le problème est que je ne sais pas comment afficher chaque valeur selecté du base mysql dans l'input correspond
le formulaire ou je veux entrer le id_circuit:
Code php5 :
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
 
<?php
require_once("connexion.php");
class circuit{
public $id_circuit;
public $Nomcircuit;
public $Villededépart;
public $Jourdedépart;
public $Jourderetour;
public $Durée;
public $Prix;
public $Supplementsingle;
public $Reductionenfant;
public $Description;
 
public function recherchedecircuit()
	{ if(isset($_POST['id_circuit']))
		{
			$id_circuit1=$_POST['id_circuit'];
			$requete ="select * from circuit where id_circuit LIKE '%$id_circuit1%'";
			if($result =mysql_query($requete))
			{
				while($row = mysql_fetch_row($result)) 
				{ 
					$id_circuit=$row[0];
					echo $id_circuit;
					$Nomcircuit=$row[1];
					echo $Nomcircuit;
					$Villededépart=$row[2];
					echo $Villededépart;
					$Jourdedépart=$row[3];
					echo $Jourdedépart;
					$Jourderetour=$row[4];
					echo $Jourderetour;
					$Durée=$row[5];
					echo $Durée;
					$Prix=$row[6];
					echo $Prix;
					$Supplementsingle=$row[7];
					echo $Supplementsingle;
					$Reductionenfant=$row[8];
					echo $Reductionenfant;
					$Description=$row[9];
					echo $Description;
				}
 
 
		    }
	    }
    }
}
 
	$obj =new circuit();
	$obj->recherchedecircuit();
?>
le formulaire ou je veux afficher les données sélectionnées:
Code php5 :
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
 
<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><center>
					<td>
					</td>
					<center>
				     <td><center>
 
				    <table width="800" height="800">
					<center>
 
						<tr>
						<td>
						<font color="white">id_circuit</font>
						</td>
						<td>
						<input name="id_circuit" type="text" value="<?php include("recherchedecircuit.php"); 
 
						?>">
						</td>
						</tr>
						<tr>
						<td>
						<font color="white">Nom circuit</font>
						</td>
						<td>
						<input name="Nomcircuit" type="text">
						</td>
						</tr>
						 <tr>
						  <td>
						    <font color="white">Ville de départ:</font>
						  </td>
						  <td>
						    <input name="Villededépart" type="text">
						  </td>
						 </tr>
						 <tr>
						<td>
 
 
						    <font color="white">Jour de départ:</font>
						  </td>
						  <td>
						    <input name="Jourdedépart" type="text">
						  </td>
						 </tr>
 
						 <tr>
						  <td>
						    <font color="white">Jour de retour:</font>
						  </td>
						  <td>
						    <input name="Jourderetour" type="text">
						  </td>
						 </tr>
						 <tr>
						  <td>
						    <font color="white">Durée:</font>
						  </td>
						  <td>
						    <input name="Durée" type="text">
						  </td>
						 </tr>
						 <tr>
						 <td>
						 <font color="white">Prix:</font>
						 </td>
						 <td>
						 <input name="Prix" type="text">
						 </td>
						 </tr>
						 <tr>
						 <td>
						 <font color="white">Supplement Single:</font>
						 </td>
						 <td>
						 <input name="Supplementsingle" type="text">
						 </td>
						 </tr>
						 <tr>
						 <td>
						 <font color="white">Reduction enfant:</font>
						 </td>
						 <td>
						 <input name="Reductionenfant" type="text">
						 </td>
						 </tr>
						 <tr>
						 <td>
						 <font color="white">Description:</font>
						 </td>
						 <td>
						 <input name="Description" type="text">
						 </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>
						<form action="sauvegardercircuit.php" method="Post" ENCTYPE=\"multipart/form-data\" >
						 <button type="button"><img src="sauvegarde.jpg" width="100" height="100"></button>
						</td>
					</tr>
					</center>
			</table></center></form>
					 </td></center>
					<td>
					</td>
				</center></tr>
			</table></center>
 
		</body>
	</html>
et merci svp aidez moi
babamama est déconnecté   Envoyer un message privé Réponse avec citation 01
Vieux 29/04/2011, 20h18   #2
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
Il faut que tu revois les bases du HTML. Ton deuxième code bourré de formulaire n'a aucun sens.
Code :
<input name="id_circuit" type="text" value="<?php include("recherchedecircuit.php");
=>
Code :
1
2
3
4
<form action="recherchedecircuit.php" method="post">
<input name="id_circuit" type="text" />
<input type="submit" value="rechercher" />
</form>
sabotage est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 12/05/2011, 21h56   #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
merci pour votre aide
c'est le code qui tourne:
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
 
public function cherchercircuit($id_circuit)
 
	{  
     if(isset($_POST['chercher']))
             {
			$requete ="select * from circuit where id_circuit LIKE '%".$_POST['id_circuit']."%';";
			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>Description:</font>
							 </td>
						     <td>
 
							 <textarea rows=10 cols=17 name='Description' value=$row[7] ></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>
						 <form method='POST' action='modifiercircuit.php'>
						<button name='sauvegarder' value='sauvegarder' type='submit' ><img src='sauvegarde.jpg' width='100' height='100'></button>
						 </form>
						</td>
					</tr>
					</center>
			</table>";
			}}}
babamama est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 12/05/2011, 23h36   #4
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
Ton code a toujours les mêmes problèmes.
Tes champs input doivent être dans un form sinon ils ne sont pas transmis.
sabotage 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 09h24.


 
 
 
 
Partenaires

Hébergement Web