Bon bha .. trop tard ..Envoyé par vincedjs
Bon bha .. trop tard ..Envoyé par vincedjs
Fait un echo de ta variable POST pour voir ce qu'il y a dedans ..
Et dans ton INPUT met un value
il doit retourner TEST!
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 <input name="textfieldsearch" type="text" id="textfieldsearch" VALUE="TEST">
avant ton if, que donne le résultat de cette ligne après postage du formulaire ?
Tu es sur que ton formulaire a pour attribut method="POST" ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 var_dump('<pre>', $_POST, '</pre>');die();
merci de vos réponses, désolé j'ai une urgence, je reprend ca demain matin merci
ca donne:Envoyé par Mr N.
et pour le formulaire:
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 string(5) " " array(10) { ["menuclick"]=> string(0) "" ["numfiche"]=> string(11) "Automatique" ["checkbox_privee"]=> string(6) "privee" ["nomfiche"]=> string(7) "z4dz84d" ["textfield"]=> string(1) "9" ["datefiche"]=> string(11) "Automatique" ["logincreafiche"]=> string(11) "Automatique" ["textarea"]=> string(2) "zd" ["textarea2"]=> string(2) "fa" ["btr"]=> string(2) "PO" } string(6) " "
return testsubmit est lié à
Code : Sélectionner tout - Visualiser dans une fenêtre à part <form id="form1" name="form1" method="post" action="" onsubmit="return testsubmit()">
et cela fonctionne trés bien avec mon 2eme form2 ou j ai la meme fonction avec document.form2.action bien sur
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 <script language="JavaScript" type="text/javascript"> function testsubmit() { if (document.form1.action=="") return false; return true; } function gopage(page) { document.form1.action = page; document.form1.submit(); } </script>
dev:
ca ne donne rienFait un echo de ta variable POST pour voir ce qu'il y a dedans ..
Et dans ton INPUT met un value
j ai donc 2 forms avec 2 fonction javascripts
Pour mon 2eme formulaire totu est posté pour le 1er aucuns
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 <script language="JavaScript" type="text/javascript"> function testsubmit() { if (document.form1.action=="") return false; return true; } function gopage(page) { document.form1.action = page; document.form1.submit(); } </script> <script language="JavaScript" type="text/javascript"> function testsubmit2() { if (document.form2.action=="") return false; return true; } function gopage(page) { document.form2.action = page; document.form2.submit(); } </script>
Tu n'aurais pas un exemple en live par hasard ?
Bein avec le form2
( fiche de renseignement )
quand j'enregistre ( bouton enregistrer une fiche )
le nom de Fiche saisie est bien posté
appartenant donc à
Code : Sélectionner tout - Visualiser dans une fenêtre à part <input name="nomfiche" type="text" id="nomfiche" value="" size="20" maxlength="20" />
lié a la fonction coller précédement
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 <form id="form2" name="form2" form="form" action="" onsubmit="return testsubmit2()" method="post" enctype="multipart/form-data" >
et donc le bouton enregistrer :
envoi bien vers la page de traitement ou je recoi correctement les données
Code : Sélectionner tout - Visualiser dans une fenêtre à part <input name="Enregistrer" type="button" class="bouton" id="Enregistrer" value="Enregistrer" onclick="gopage('traitementfiche.php')"/>
Je te parle plutot d'une adresse que l'on puisse tester nous même, genre une page temporaire sur ton site perso ou autre.
Est-ce que tu peux coller ici le code source de la page générée (menu affichage du navigateur) Où on peut voir tes formulaires et ton champ fantome...
c est en local pas d adresse
sinon la page génèré est vide
et voici mon accueil.php ou il a mes formulaire on m'on fameux champ de recherche 'textfieldsearch' tu l'aura voulu
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356 <?php session_start(); include ('secure.php');?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Top secret hihi</title> <link href="css/style.css" rel="stylesheet" type="text/css" /> <script language="JavaScript" type="text/javascript"> function testsubmit() { if (document.form1.action=="") return false; return true; } function gopage(page) { document.form1.action = page; document.form1.submit(); } </script> <script language="JavaScript" type="text/javascript"> function testsubmit2() { if (document.form2.action=="") return false; return true; } function gopage(page) { document.form2.action = page; document.form2.submit(); } </script> </head> <body onload="document.form1.textfieldsearch.focus()"> <table width="971" height="192" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> <tr> <th width="971" height="125" align="center" valign="middle" bgcolor="#E7E7E7" scope="col"> <table width="1032" height="104" border="0" cellpadding="0" cellspacing="0"> <tr> <th width="1032" align="left" valign="top" scope="col"> <table width="934" height="1313" border="0" align="left" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> <tr> <th width="934" height="1313" align="left" valign="top" scope="col"> <table width="701" height="150" border="0" cellpadding="0" bgcolor="#FFFFFF"> <tr> <th width="256" height="146" align="right" valign="top" bgcolor="#FFFFFF" scope="row"> <img src="images/logorbdcblanc.jpg" alt ="7" width="229" height="136" /></th> <td width="439" align="right" valign="top" bgcolor="#FFFFFF"> <table width="386" border="0" cellspacing="0" cellpadding="0"> <tr> <th width="386" align="left" valign="top" scope="col"> <form id="form1" name="form1" form="form" method="post" action="" onsubmit="return testsubmit()"> <table width="350" border="0" cellspacing="0" cellpadding="0"> <tr> <th width="249" height="47" scope="col"><strong class="entetelarge"> <u>Recherche par mots clés :</u></strong></th> <th width="101" scope="col"><span class="entetelarge"> <label><u>Projet :</u></label> </span></th> </tr> </table> <table width="366" border="0" cellspacing="0" cellpadding="0"> <tr> <th width="186" height="51" scope="col"> <input name="textfieldsearch" type="text" id="textfieldsearch" size="25" maxlength="30" value="test"/></th> <th width="40" align="left" valign="middle" scope="col"> <input name="bt_search" type="button" class="bouton" id="bt_search" value="ok" onclick="gopage('traitementsearch.php')"/></th> <th width="47" align="right" valign="middle" scope="col"><span class="Gras"> <input type="radio" name="btprojet" value="MIS" checked="checked" /> </span></th> <th width="77" align="left" valign="middle" scope="col"> <span class="Gras">MIS </span></th> </tr> </table> <table width="366" border="0" cellspacing="0" cellpadding="0"> <tr> <th width="187" scope="col"><div align="center"> <select name="selectsearch" id="selectsearch"> </select> </div></th> <th width="36" align="left" valign="middle" scope="col"> <input name="bt_envoi_search" type="button" class="bouton" id="bt_envoi_search" value="ok" onclick="gopage('searchfiche.php')"/></th> <th width="50" align="right" valign="middle" scope="col"><strong> <input type="radio" name="btprojet" value="REDLIFT" /> </strong></th> <th width="77" align="left" valign="middle" scope="col"> <strong>REDLIFT </strong></th> </tr> </table> </form></th> </tr> </table></td> </tr> </table> <form id="form2" name="form2" form="form" action="" onsubmit="return testsubmit2()" method="post" enctype="multipart/form-data" > <table width="566" border="0" cellspacing="0" cellpadding="0"> <tr> <th width="116" height="921" scope="col"> </th> <th width="170" scope="col"><table width="820" height="1048" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="41" align="center" valign="top"> </td> <td align="left" valign="top"><table width="452" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="449" height="35" align="center" valign="middle"> <img src="images/barrehnoir.gif" alt="a" width="237" height="17" /></td> </tr> </table></td> <td align="center" valign="top"> </td> </tr> <tr> <td width="173" height="902" align="center" valign="top"> <table width="173" border="0" cellpadding="0" cellspacing="0"> <tr> <th scope="col"> </th> <th align="center" valign="bottom" scope="col"> <img src="images/rechercheimg.jpg" alt="f" width="148" height="45" /></th> </tr> <?php //insert le menu include ('menu.php'); //champ caché?> <input type="hidden" name="menuclick" value="" /> </table></td> <td width="453" align="left" valign="top"> <table width="452" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="83" align="right" valign="bottom"> <span class="Style3">Fiche n° </span></td> <td width="216" align="left" valign="bottom"><input name="numfiche" type="text" class="Gras" id="numfiche" value="Automatique" size="12" maxlength="12" /></td> <td width="153" align="left" valign="bottom"><label> <span class="Style3">Privée:</span> <input name="checkbox_privee" type="checkbox" id="checkbox_privee" value="privee"/> </label></td> </tr> <tr> <td height="42" align="right" valign="bottom" class="Style3">Nom fiche : </td> <td align="left" valign="bottom"> <input name="nomfiche" type="text" id="nomfiche" value="" size="20" maxlength="20" /></td> <td align="left" valign="bottom"><label> <span class="Style3">NB heures:</span> <input name="textfield" type="text" size="5" maxlength="5" /> </label></td> </tr> </table> <table width="452" border="0" cellspacing="0" cellpadding="0"> <tr> <th height="39" scope="col"> <span class="Style3">Dernière modification le :</span> <input name="datefiche" type="text" id="datefiche" value="Automatique" size="12" maxlength="12" /></th> </tr> <tr> <th width="452" scope="col"><div align="center"><span class="Style3">par : </span> <input name="logincreafiche" type="text" id="logincreafiche" value="Automatique" size="12" maxlength="12" /> <img src="images/mail13.gif" alt="ezfz" width="32" height="32" onclick="return emailfiche()"/></div></th> </tr> </table> <table width="452" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="455" height="239" align="center" valign="top"><label><br /> <span class="entetelarge">Descriptif</span> <br /> <br /> <textarea name="textarea" cols="50" rows="12" id="textarea"></textarea> </label></td> </tr> </table> <table width="452" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="452" align="center" valign="top"><label></label> <span class="entetelarge"><br /> Résolution</span><br /> <br /> <textarea name="textarea2" cols="50" rows="12" id="textarea2"></textarea></td> </tr> </table> <table width="453" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="453" height="48" align="center" valign="bottom"> <u>Fichier joint :</u> <input name="fichiers" type="file" id="fichiers" size="24" maxlength="30" /></td> </tr> </table> <table width="452" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="449" height="45" align="center" valign="bottom"> <img src="images/barrehnoir.gif" alt="a" width="237" height="17" /></td> </tr> </table> <table width="452" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="44" align="center" valign="bottom"> <span class="Gras">Sauvegarder :</span> <input name="Enregistrer" type="button" class="bouton" id="Enregistrer" value="Enregistrer" onclick="gopage('traitementfiche.php')"/></td> </tr> <tr> <td width="447" height="44" align="center" valign="bottom"> <label><span class="Gras">Supprimer cette fiche :</span> <input name="supprimer" type="button" id="supprimer" value="Supprimer" onclick="gopage('supprimerfiche.php')" /> </label></td> </tr> </table> <table width="452" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="446" height="45" align="center" valign="bottom"> <img src="images/barrehnoir.gif" alt="a" width="237" height="17" /></td> </tr> </table> <table width="452" border="0" cellspacing="0" cellpadding="0"> <tr> <th width="447" height="38" align="center" valign="bottom" scope="col"> <em>Liste des fichiers joints :</em></th> </tr> <tr> <th align="center" valign="bottom" scope="row"> <select name="select" id="select"> </select> <input name="bt_fichiers" type="button" class="bouton" id="bt_fichiers" value="Ouvrir" onclick="gopage('')"/> <a href="index.php">Retour à l'accueil</a></th> </tr> </table></td> <td width="194" align="left" valign="top"> <table width="190" border="0" cellspacing="0" cellpadding="0"> <tr> <th scope="col"> </th> <th align="center" valign="bottom" scope="col"> <img src="images/saisieimg.jpg" alt="f" width="84" height="45" /></th> </tr> <tr> <th width="10" height="35" scope="col"> </th> <th width="163" align="center" valign="bottom" scope="col"> -MIS</th> </tr> <tr> <th height="53" scope="row"> </th> <td align="left" valign="bottom"> <input type="radio" name="btr" value="AP" checked="checked"/> AP</td> </tr> <tr> <th height="47" scope="row"> </th> <td align="left" valign="bottom"><input type="radio" name="btr" value="GL" /> GL</td> </tr> <tr> <th height="48" scope="row"> </th> <td align="left" valign="bottom"><input type="radio" name="btr" value="AR" /> AR</td> </tr> <tr> <th height="54" scope="row"> </th> <td align="left" valign="bottom"><input type="radio" name="btr" value="FA" /> FA</td> </tr> <tr> <th height="49" scope="row"> </th> <td align="left" valign="bottom"><input type="radio" name="btr" value="PO" /> PO</td> </tr> <tr> <th height="51" scope="row"> </th> <td align="left" valign="bottom"><input type="radio" name="btr" value="EIP" /> EIP</td> </tr> <tr> <th height="47" scope="row"> </th> <td align="left" valign="bottom"><input type="radio" name="btr" value="CM" /> CM</td> </tr> <tr> <th height="40" scope="row"> </th> <td align="left" valign="bottom"><input type="radio" name="btr" value="OFA" /> OFA</td> </tr> <tr> <th height="22" scope="row"> </th> <td> </td> </tr> </table> <table width="190" height="316" border="0" cellpadding="0" cellspacing="0"> <tr> <th width="10" scope="col"> </th> <th width="181" align="center" valign="bottom" scope="col">-REDLIFT</th> </tr> <tr> <th height="51" scope="row"> </th> <td align="left" valign="bottom"><span class="Titregrand"> <input type="radio" name="btr" value="SPSS" /> </span>SPSS</td> </tr> <tr> <th height="48" scope="row"> </th> <td align="left" valign="bottom"> <input type="radio" name="btr" value="CLEMENTINE" /> CLEMENTINE</td> </tr> <tr> <th height="48" scope="row"> </th> <td align="left" valign="bottom"><input type="radio" name="btr" value="BDD" /> BDD</td> </tr> <tr> <th height="43" scope="row"> </th> <td align="left" valign="bottom"><span class="Gras"> <input type="radio" name="btr" value="FORMATION" /> </span>FORMATION</td> </tr> <tr> <th height="46" scope="row"> </th> <td align="left" valign="bottom"> <input type="radio" name="btr" value="TRUCS ET ASTUCES" /> TRUCS ET ASTUCES</td> </tr> <tr> <th height="46" scope="row"> </th> <td align="left" valign="bottom"> <input type="radio" name="btr" value="AUTRES" /> AUTRES</td> </tr> </table></td> </tr> </table></th> <th width="64" scope="col"> </th> </tr> </table> </form> <br /></th> </tr> </table> </th> </tr> </table></th> </tr> </table> </body> </html>
lorsque tu cliques sur le bouton ok de ton formulaire de recherche, tu appelles gopage qui modifie et soumet le form2. Or ce form2 ne contient pas le champ textfieldsearch puisque ce dernier est dans le form1...
je comprend pas le bouton "ok" est donc:
est soumis a traitementsearch.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part <input name="bt_search" type="button" class="bouton" id="bt_search" value="ok" onclick="gopage('traitementsearch.php')"/>
Et est dans le form 1
testsubmit() est bien lié a form1 :
Code : Sélectionner tout - Visualiser dans une fenêtre à part <form id="form1" name="form1" form="form" method="post" action="" onsubmit="return testsubmit()">
J'ai mal compris, on s est mal compris, ou j'ai fait 1 bétise?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 <script language="JavaScript" type="text/javascript"> function testsubmit() { if (document.form1.action=="") return false; return true; } function gopage(page) { document.form1.action = page; document.form1.submit(); } </script>
Tu as deux définitions de gopage(), la deuxième écrasant la première.
quelqu'un a une solution alors car moi je ne sais pas du tout
oups je suis bete j vai ajouté 2 au nom de la fonction
c est bon merci car maintenant il m'affiche une erreur de la page, donc c est une autre histoire qui commence
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 Warning: Wrong parameter count for mysql_db_query() in C:\wamp\www\rbdc\traitementsearch.php on line 42 La requête SQL executée est : select * from fiches where 1
Vous avez un bloqueur de publicités installé.
Le Club Developpez.com n'affiche que des publicités IT, discrètes et non intrusives.
Afin que nous puissions continuer à vous fournir gratuitement du contenu de qualité, merci de nous soutenir en désactivant votre bloqueur de publicités sur Developpez.com.
Partager