Bonsoir
depuis la mise en place de listes liées ,mon formulaire ne fait plus les maj des tables.
je pense que c'est un problème de récupération de variables mais je ne vois pas d'où vient le problème.
des que j'envoie le formulaire,les champs saisis sont RAZ
Dans la zone URL du navigateur :http://nomsite.free.fr/ms_member/for...7777777&cat=CF
mes requêtes sql

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 $requete=mysql_query('insert into fusion10m (jourc, heurec, nom, prenom, club, nlicence, cat, dis) 
	values ( "'.$jourc.'", "'.$heurec.'", "'.$nom.'", "'.$prenom.'", "'.$club.'", "'.$nlicence.'", "'.$cat.'", "'.$dis.'")');
ma req attend st10m pour dis,dans l'url j'ai d0
samedi pour jourc au lieu de d0j0
10h30 pour heurec au lieu de d0j0h0
Je vous joint le formulaire .
merci de votre aide
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
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
<?php 
 //ini_set("display_errors",-1);error_reporting(E_ALL);
 
//On charge les variables
include ('includes/vars.php');
?>
<html lang="fr">
	<head>
 
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
		<title><?php echo TITRE_SITE; ?></title>
		<link href="style.css" rel="stylesheet" type="text/css" id="css" media="screen, projection" /> 
		<link href="<?php echo URL_SCRIPT; ?>/admin/design.css" rel="stylesheet" type="text/css" id="css"  />
 
 
		<script type="text/javascript">
	var dis = []; //nouveau tableau
	dis[0] = ["d0", "st10m"]; //
	dis[1] = ["d1", "vit10m"];
	dis[2] = ["d2", "p10"];
	dis[3] = ["d3", "c10"];
 
	var jourc = [];
	//dis0-jourc0
	jourc["d0"] = [];
	jourc["d0"][0] = ["d0j0", "samedi"];
	jourc["d0"][1] = ["d0j1", "dimanche"];
 
	var heurec=[];
	// dis0 jour0 samedi
	heurec["d0j0"] = [];
	heurec["d0j0"][0] = ["d0j0h0", "9h"];
	heurec["d0j0"][1] = ["d0j0h1", "9h30"];
	heurec["d0j0"][2] = ["d0j0h2", "10h"];
	heurec["d0j0"][3] = ["d0j0h3", "10h30"];
	//dis0 jour1 dimanche
 
	heurec["d0j1"] = [];
	heurec["d0j1"][0] = ["d0j1h0", "9h"];
	heurec["d0j1"][1] = ["d0j1h1", "9h30"]; 
	heurec["d0j1"][2] = ["d0j1h2", "10h"];
	heurec["d0j1"][3] = ["d0j1h3", "10h30"];
	//discipline 1
	jourc["d1"] = [];
	jourc["d1"][0] = ["d1j0", "samedi"];
	jourc["d1"][1] = ["d1j1", "dimanche"];
 
	//dis1 jour0 samedi
 
	heurec["d1j0"]=[];
	heurec["d1j0"][0] = ["d1j0h0", "9h"];
	heurec["d1j0"][1] = ["d1j0h1", "9h30"];
	heurec["d1j0"][2] = ["d1j0h2", "10h"];
	heurec["d1j0"][3] = ["d1j0h3", "10h30"];
 
	//dis1 jour1 dimanche	
 
	heurec["d1j1"]=[];
	heurec["d1j1"][0] = ["d1j1h0", "9h"];
	heurec["d1j1"][1] = ["d1j1h1", "9h30"];
	heurec["d1j1"][2] = ["d1j1h2", "10h"];
	heurec["d1j1"][3] = ["d1j1h3", "10h30"];
 
	//discipline 2
	jourc["d2"] = [];
	jourc["d2"][0] = ["d2j0", "samedi"];
	jourc["d2"][1] = ["d2j1", "dimanche"]; 
	//dis2 jour0 samedi
 
	heurec["d2j0"] = [];
	heurec["d2j0"][0] = ["d2j0h0", "14h"];
	heurec["d2j0"][1] = ["d2j0h1", "16h"];
 
	//dis2 jour1 dimanche
 
	heurec["d2j1"] = [];
	heurec["d2j1"][0] = ["d2j1h0", "14h"];
	heurec["d2j1"][1] = ["d2j1h1", "16h"];
 
 
   //discipline 3
	jourc["d3"] = [];
	jourc["d3"][0] = ["d3j0", "samedi"];
	jourc["d3"][1] = ["d3j1", "dimanche"];
 
	//dis3 jour0 samedi
 
	heurec["d3j0"] = [];
	heurec["d3j0"][0] = ["d3j0h0", "14h"];
	heurec["d3j0"][1] = ["d3j0h1", "16h"];
 
	//dis2 jour1 dimanche
 
	heurec["d3j1"] = [];
	heurec["d3j1"][0] = ["d3j1h0", "14h"];
	heurec["d3j1"][1] = ["d3j1h1", "16h"];
 
 
	function filltheselect(liste, choix)
	{switch (liste)
	   {
	   case "listedis":
	      raz("listejourc");
	      raz("listeheurec");
	      for (i=0; i<jourc[choix].length; i++)
	         {
	         new_option = new Option(jourc[choix][i][1],jourc[choix][i][0]);
	         document.formu.elements["listejourc"].options[document.formu.elements["listejourc"].length]=new_option;
	         }
	      for (i=0; i<heurec[choix+"j0"].length; i++)
	         {
	         new_option = new Option(heurec[choix+"j0"][i][1],heurec[choix+"j0"][i][0]);
	         document.formu.elements["listeheurec"].options[document.formu.elements["listeheurec"].length]=new_option;
	         }
	      break;
	   case "listejourc":
	      raz("listeheurec");
	      for (i=0; i<heurec[choix].length; i++)
	         {
	         new_option = new Option(heurec[choix][i][1],heurec[choix][i][0]);
	         document.formu.elements["listeheurec"].options[document.formu.elements["listeheurec"].length]=new_option;
	         }
	      break;
 
	   }
	}
 
 
 
	function addNewOption ( nomselect, index, valeur, texte ) 
	{ 
	  var new_option = new Option( texte, valeur );
	  document.formu.elements[nomselect].options[index] = new_option;
	}
 
 
function raz(liste)
	{l=document.formu.elements[liste].length;
	for (i=l; i>=0; i--)
	   document.formu.elements[liste].options[i]=null;
	}
	</script>
 
 
 
	</head>
		<div align="center">
	    <div id="en_tete">
	    </div>
	    </div>
 
 
<div id="global">
 
<?php 
include ('includes/menu.php');
 
?>
<div id="corps">
 
<hr>
 
<?php
//On se connecte a la Base de donnee
include('mysqlcnn.php');
include ("admin/config/config.php");
//On verifie si le formulaire a ete envoye
if  (  !empty($_POST['jourc']) 
	&& !empty($_POST['heurec'])
	&& !empty($_POST['nom'])
	&& !empty($_POST['prenom'])
	&& !empty($_POST['club'])
	&& !empty($_POST['nlicence'])  
	&& !empty($_POST['cat'])
	&& !empty($_POST['dis'])
	 )
 
	 	{
 
				//On echape les variables pour pouvoir les mettre dans une requete SQL
				$jourc = mysql_real_escape_string($_POST['jourc']);
				$heurec = mysql_real_escape_string($_POST['heurec']);
				$nom = mysql_real_escape_string($_POST['nom']);
				$prenom = mysql_real_escape_string($_POST['prenom']);
				$club = mysql_real_escape_string($_POST['club']);
				$nlicence = mysql_real_escape_string($_POST['nlicence']);
				$cat = mysql_real_escape_string($_POST['cat']);	
				$dis = mysql_real_escape_string($_POST['dis']);
 
				//test de la discipline demandee  
				if (($dis=="c10m") || ($dis=="p10m"))  
				    	{ 
						$tble = "pre10m";
						$nbp = 35;
						//echo ' '.$tble.' ' ; 
						//echo ' '.$nbp.' postes' ; 
						}
 
					 else if ($dis=="vit10m")  
				    	{ 
						$tble = "vit10m";
						$nbp = 5;
						//echo ' '.$tble.' ' ; 
						//echo ' '.$nbp.' postes' ; 
						}
					 else if ($dis=="st10m")  
				    	{ 
						$tble = "st10m";
						$nbp = 5;
						//echo ' '.$tble.' ' ; 
						//echo ' '.$nbp.' postes' ; 
						}
				$requet = 'SELECT COUNT(*) as total FROM '.$tble.' where nlicence='.$nlicence.'';
$resul = mysql_query($requet);
$data=mysql_fetch_assoc($resul);
echo $data['total'];		
 
               if($data['total'] >= 1)				     
 
				{
				echo '<a1><b1>licencie deja inscrit !</a1></b1><br />';  			   
?>			   
 
			  <script type="text/javascript">
               <!--
               window.setTimeout
	           ('document.location.href="form_inscrits10m.php"',2000);
               //-->
               </script> 
 
<?php
               exit();
                } 
 
			   //verification du nombre d'inscrits max 5
			  $test1 = mysql_num_rows(mysql_query('SELECT jourc FROM '.$tble.' where jourc="'.$jourc.'" && heurec="'.$heurec.'" && dis="'.$dis.'"')); 
               echo '<a1><b1> nbinscrits : '.$test1.' </a1></b1>';               
               if("'.$test1.'" < "'.$nbp.'")
 
				{  	 
				   $reste=($nbp) - ($test1);
				 //  	  echo '<br /> <a1>il reste :'.$reste.' postes</a1>';
			   	$requ=mysql_query('insert into '.$tble.'(jourc, heurec, nom, prenom, club, nlicence, cat, dis) 
	values ( "'.$jourc.'", "'.$heurec.'", "'.$nom.'", "'.$prenom.'", "'.$club.'", "'.$nlicence.'", "'.$cat.'", "'.$dis.'")');
if($requ)
 {
echo '<br /><a1><b1>Inscription reussie !</b1></a1><br />';
		$reste1= ($reste-1);
echo '<br /> <a1>il reste :'.$reste1.' postes</a1>'; 
  	$requete=mysql_query('insert into fusion10m (jourc, heurec, nom, prenom, club, nlicence, cat, dis) 
	values ( "'.$jourc.'", "'.$heurec.'", "'.$nom.'", "'.$prenom.'", "'.$club.'", "'.$nlicence.'", "'.$cat.'", "'.$dis.'")'); 
 
if($requete)
 {
//echo '<br /><a1><b1>table fusion10m mise à jour</b1></a1><br />'; 
 
$form = false;
	}
	}				
else  
{
echo'echec inscription dans la base de donnees';	
					}
					}	
	  //Sinon serie complete
					else
					 	{	  
					 if ($test1 >= '.$nbp.') 
					 {
					 $form = true; 
					 echo '<br /><b1>Il y a : ...  '.$test1.' ... inscrits</b1><br />';
 
						echo  '<a1><b1>serie complete...... Choisissez en une autre</b1></a1>';
						}
			 	}	
	}
	 				else
					{
			//Sinon remplissez tous les champs 
					 if	(  empty($_POST['jourc']) 
	|| empty($_POST['heurec']) || empty($_POST['nom']) || empty($_POST['prenom']) || empty($_POST['club']) || empty($_POST['nlicence']) || empty($_POST['cat'])	|| empty($_POST['dis']))
	 				  {
			 		  $form = true; 
					  //echo ''.$jourc.', '.$heurec.', '.$nom.', '.$prenom.', '.$club.', '.$nlicence.', '.$cat.', '.$dis.', '.$tble.'';
					  echo  '<a1><b1>remplissez tous les champs !.</b1></a1>';
					  }
 
} 
?>		
 
 <h2>INSCRIPTION DEPARTEMENTAUX 10M </h2> 
<hr />
 
 
	<form name="formu"> 
	Choisir une discipline
	<select name="listedis" onChange='filltheselect(this.name, this.value)'>
	   <script type="text/javascript">
	   for (i=0; i<dis.length; i++){
	      addNewOption ( 'listedis', i, dis[i][0], dis[i][1] );  
	   }
	   </script>
	</select>
	<br><br />
	 Choisir un jour
	<select name="listejourc" onChange='filltheselect(this.name, this.value)'>
	   <script type="text/javascript">
	   for (i=0; i<jourc["d0"].length; i++){
	      addNewOption ( 'listejourc', i, jourc["d0"][i][0], jourc["d0"][i][1] ); 
 
	   }
	   </script>
	</select>
	 <br><br />
	 Choisir une heure
	<select name="listeheurec">
	   <script type="text/javascript">
	   for (i=0; i<heurec["d0j0"].length; i++){
	      addNewOption ( 'listeheurec', i, heurec["d0j0"][i][0], heurec["d0j0"][i][1] );  
	   }
	   </script>
	</select> 
	<br /><br />
Nom :<input type="text" name="nom"  value="<?php if(isset($_POST['nom'])){echo $_POST['nom'];} ?>" /><br /><br />  
Prenom :<input type="text" name="prenom"  value="<?php if(isset($_POST['prenom'])){echo $_POST['prenom'];} ?>" /><br /><br />  
Club :<input type="text" name="club"  value="<?php if(isset($_POST['club'])){echo $_POST['club'];} ?>" /><br /><br />  
Nlicence :<input type="text" name="nlicence"  value="<?php if(isset($_POST['nlicence'])){echo $_POST['nlicence'];} ?>" /><br /><br />  
Cat:
<select name="cat" /> 
<?php // on va l'écrire en PHP :
	$cat_values = array( 'CF', 'CG', 'JF', 'JG', 'D1', 'S1', 'D2', 'S2', 'D3', 'S3' );
	$cat_names = array( 'CF', 'CG', 'JF', 'JG', 'D1', 'S1', 'D2', 'S2', 'D3', 'S3' ); // peut être différent des value !
		foreach( $cat_values as $cat_index => $cat_value )
		{
			$selected = ( isset($cat) && $cat==$cat_value )? ' selected="selected"' : '';
?>
	<option value="<?php echo $cat_value; ?>"<?php echo $selected; ?>><?php echo $cat_names[$cat_index]; ?></option>
<?php
		}
?>
</select><br /> 
</select><br /> 
<h2>
 <?php 
$datedeb="01-02-2015";
$datefin="21-03-2015";	
$date = date("d-m-Y");
if ((strtotime($date)<strtotime($datedeb)) || (strtotime($date)>strtotime($datefin)))			
	{	
	 echo " <a1>INSCRIPTIONS OUVERTES DU : $datedeb au $datefin.... Vous avez dépassé le délai !!!</a1><br /><br />";
	echo  '<input type="submit" value="Envoyer" disabled />';	
	} 
	else 
	  {	
	  echo " <a1>INSCRIPTIONS OUVERTES DU : $datedeb au $datefin</a1><br /><br />";
	 echo '<input type="submit" value="Envoyer" enabled />';	
	   }
?>
</form>
 
<br /><br /> 
<a href="<?php echo URL_SCRIPT; ?>/export_inscrits10m.php">Export vers EXCEL de la table</a> <br /><br />
 
<a href="<?php echo URL_SCRIPT; ?>/accueil.php">retour a l'accueil</a>
<br />
<a href="<?php echo URL_SCRIPT; ?>/contact.php">contacter le webmaster</a> <br />
</h2>
</h4>
</div>
 
</div>
 
</html>	
 
</body>