Bonjour,
je débute en php, désolé de devoir vous solliciter mais je suis coincé depuis quelque temps sur un problème que je ne parviens pas à résoudre.
Je récupère des données d’une BDD Mysql que je place dans un formulaire, je transfère ces données dans une autre page php via la méthode POST , le fomulaire s’affiche correctement avec les bonnes données, jusque-là tout va bien.
Mais ensuite je dois valider ce dernier formulaire pour faire un INSERT dans ma BDD, pour ce faire je le transfert à la même page encore une fois par la méthode POST , malheureusement j’obtiens une page vide, je ne comprends pourquoi.
Pourriez-vous plaît jeter un œil à mon code et me dire ou je fais une erreur ?
// récup des données de la BDD
// affichage des données puis renvoie de ces meme données par post
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 while($row = mysql_fetch_array($result)) { if (($row['CONTAINER']) == '0') {$cont = 'non'; } else {$cont = 'oui'; } echo "<form action='index.php?IdPage=7' name='formulaire' method='post'><tr onmouseover=\"this.className='survol';\" onmouseout=\"this.className='parti';\">"; echo "<td class='tableau_cell Style6 cacher-column' align='center'><input class= type='hidden' name='ID' value=".$row['ID']."></td>"; echo "<td width='110' class='tableau_cell Style6' align='center'><input type='hidden' name='NOM' value='".$row['NOM']."'>".$row['NOM']."</td>"; echo "<td width='110' class='tableau_cell Style6' align='center'><input type='hidden' name='PRENOM' value='".$row['PRENOM']."'>".$row['PRENOM']."</td>"; echo "<td width='70' class='tableau_cell Style6' align='center'><input type='hidden' name='NUMVOIE' value=".$row['NUMVOIE'].">".$row['NUMVOIE']."</td>"; echo "<td width='110' class='tableau_cell Style6' align='center'><input type='hidden' name='NOMVOIE' value='".$row['NOMVOIE']."'>".$row['NOMVOIE']."</td>"; echo "<td width='70' class='tableau_cell Style6' align='center'><input type='hidden' name='NBPERSONNE' value=".$row['NBPERSONNE'].">".$row['NBPERSONNE']."</td>"; echo "<td width='70' class='tableau_cell Style6' align='center'><input type='hidden' name='CONTAINER' value=".$cont.">".$cont."</td>"; echo "<td width='50' class='tableau_cell Style6' align='center'><input type='hidden' name='IDDROITSAC' value=".$row['IDDROITSAC']."></td>"; echo "<td width='50' class='tableau_cell Style6' align='center'><input type='hidden' name='SAC_JAUNE' value=".$row['SAC_JAUNE'].">".$row['SAC_JAUNE']."</td>"; echo "<td width='45' class='tableau_cell Style6' align='center'><input type='hidden' name='SAC_NOIR' value=".$row['SAC_NOIR'].">".$row['SAC_NOIR']."</td>"; echo "<td width='50' class='tableau_cell Style6' align='center'><input name='valider' type='submit' value='Valider' class='taill_button' onclick='pages/?IdPade=7'/> </td>"; echo "<td width='50' class='tableau_cell Style6' align='center'><input name='modifier' type='button' value='Modifier' class='taill_button'/> </td>"; echo "<td width='30' class='tableau_cell Style6' align='center'><input type='submit' name='suppr' class='bouton' value='' onClick='submit' /> </td>"; echo "</tr></form>"; } echo " </tbody> </table>"; }
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
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194 <HTML> <HEAD> <link href='../styles/style_1.css' rel='stylesheet' type='text/css' /> </HEAD> <BODY> <?php //date_default_timezone_set('Europe/Paris'); setlocale (LC_TIME, 'fr_FR', 'fra'); $datef = (strftime("%A %d %B %Y à %Hh %Mmn")); $datei = (strftime("%Y%m%d%H%M%S")); if (isset($_POST['applique'])) { $id = $_POST['ID']; $nom = $_POST['NOM']; $prenom = $_POST['PRENOM']; $nomvoie = $_POST['NOMVOIE']; $numvoie = $_POST['NUMVOIE']; $nbpersonne = $_POST['NBPERSONNE']; $container = $_POST['CONTAINER']; $iddroitsac = $_POST['IDDROITSAC']; $sac_jaune = $_POST['SAC_JAUNE']; $sac_noir = $_POST['SAC_NOIR']; echo "<form name='applique' action='index.php?IdPage=7' ENCTYPE='text/plain' method='post'> <table width='100%' height='70' cellspacing='1' border='1'> <tr> <td class='Style11'>Appliquer la dotation</td> </tr> </table> <table width='100%' cellspacing='0' class='color_tab'> <tr> <td width='70'>Nom :</td> <td class='Style17 cell_auto'><input type='hidden' name='NOM' value=".$nom." />".$nom."</td> </tr> <tr> <td width='70'>Prénom : </td> <td class='cell_auto Style17'><input type='hidden' name='PRENOM' value=".$prenom." />".$prenom."</td> </tr> </table> <table width='100%' cellspacing='0' class='color_tab'> <tr> <td width='70'>Adresse : </td> <td class='Style17' class='cell_auto'><input type='hidden' name='NOMVOIE' value=".$nomvoie." />".$nomvoie."</td> <td width='70'>Numéro : </td> <td class='Style17' width='50'><input type='hidden' name='NUMVOIE' value=".$numvoie." />".$numvoie."</td> <td width='40'>Date : </td> <td class='Style17' class='cell_auto'><input type='hidden' name='DATEF' value=".$datei." />".$datef."</td> </tr> <tr> </table> <table cellspacing='0' width='100%' class='color_tab'> <td width='150'>Nombre de personne : </td> <td class='Style17'><input type='hidden' name='NBPERSONNE' value=".$nbpersonne." /> ".$nbpersonne."</td> <td width='75'>Container :</td> <td class='Style17'><input type='hidden' name='CONTAINER' value=".$container." /> ".$container."</td> <td width='90'>Sacs Jaunes : </td> <td class='Style17'><input type='hidden' name='SAC_JAUNE' value=".$sac_jaune."/>".$sac_jaune."</td> <td width='80'>Sacs noirs : </td> <td colspan='2' class='Style17'><input type='hidden' name='SAC_NOIR' value=".$sac_noir." />".$sac_noir." </td> </tr> <tr class='tableau_dot'> <td colspan='9'> </td> </tr> <tr align='right'> <td height='28' colspan='9'>Appliquer la dotation : <input type='submit' name='applique' value='Valider' /> <input type='reset' name='annuler' value='Annuler' /></td> </tr> </table> <input type='text' name='ID' value=".$id." /> <input type='text' name='IDDROITSAC' value=".$iddroitsac." /> </form>"; } if (isset($_POST['valider'])) { $id = $_POST['ID']; $nom = $_POST['NOM']; $prenom = $_POST['PRENOM']; $nomvoie = $_POST['NOMVOIE']; $numvoie = $_POST['NUMVOIE']; $nbpersonne = $_POST['NBPERSONNE']; $container = $_POST['CONTAINER']; $iddroitsac = $_POST['IDDROITSAC']; $sac_jaune = $_POST['SAC_JAUNE']; $sac_noir = $_POST['SAC_NOIR']; echo "<form name='applique' action='index.php?IdPage=7' ENCTYPE='text/plain' method='post'> <table width='100%' height='70' cellspacing='1' border='1'> <tr> <td class='Style11'>Appliquer la dotation</td> </tr> </table> <table width='100%' cellspacing='0' class='color_tab'> <tr> <td width='70'>Nom :</td> <td class='Style17 cell_auto'><input type='hidden' name='NOM' value=".$nom." />".$nom."</td> </tr> <tr> <td width='70'>Prénom : </td> <td class='cell_auto Style17'><input type='hidden' name='PRENOM' value=".$prenom." />".$prenom."</td> </tr> </table> <table width='100%' cellspacing='0' class='color_tab'> <tr> <td width='70'>Adresse : </td> <td class='Style17' class='cell_auto'><input type='hidden' name='NOMVOIE' value=".$nomvoie." />".$nomvoie."</td> <td width='70'>Numéro : </td> <td class='Style17' width='50'><input type='hidden' name='NUMVOIE' value=".$numvoie." />".$numvoie."</td> <td width='40'>Date : </td> <td class='Style17' class='cell_auto'><input type='hidden' name='DATEF' value=".$datei." />".$datef."</td> </tr> <tr> </table> <table cellspacing='0' width='100%' class='color_tab'> <td width='150'>Nombre de personne : </td> <td class='Style17'><input type='hidden' name='NBPERSONNE' value=".$nbpersonne." /> ".$nbpersonne."</td> <td width='75'>Container :</td> <td class='Style17'><input type='hidden' name='CONTAINER' value=".$container." /> ".$container."</td> <td width='90'>Sacs Jaunes : </td> <td class='Style17'><input type='hidden' name='SAC_JAUNE' value=".$sac_jaune."/>".$sac_jaune."</td> <td width='80'>Sacs noirs : </td> <td colspan='2' class='Style17'><input type='hidden' name='SAC_NOIR' value=".$sac_noir." />".$sac_noir." </td> </tr> <tr class='tableau_dot'> <td colspan='9'> </td> </tr> <tr align='right'> <td height='28' colspan='9'>Appliquer la dotation : <input type='submit' name='applique' value='Valider' /> <input type='reset' name='annuler' value='Annuler' /></td> </tr> </table> <input type='text' name='ID' value=".$id." /> <input type='text' name='IDDROITSAC' value=".$iddroitsac." /> </form>"; } ?> </BODY> </HTML>
Partager