IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

AJAX Discussion :

[AJAX] 3 Listes liées en AJAX


Sujet :

AJAX

  1. #1
    Membre averti
    Femme Profil pro
    ...
    Inscrit en
    Avril 2009
    Messages
    49
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : ...

    Informations forums :
    Inscription : Avril 2009
    Messages : 49
    Par défaut [AJAX] 3 Listes liées en AJAX
    Bonjour,

    J'essaye de lier 3 listes générées par une base de données. Jusqu'à maintenant j'ai réussis à lier deux listes : type_formation et niveau_formation. Cependant j'aimerai que niveau_formation soit lié à une autre liste qui est specification_formation. Voici le code que j'ai mis en place mais qui ne fonction que pour les 2 premières listes

    menu.php
    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
    <html>
     
    	<head>
     
    		<title>Inscription</title>
     
    		<script type='text/javascript'>
     
    			function getXhr()
    			{
    				var xhr = null;
     
    				if(window.XMLHttpRequest)// Firefox et autres
    				{
    					xhr = new XMLHttpRequest(); 
    				}
    				else if(window.ActiveXObject)// Internet Explorer 
    				{
    					try
    					{
    						xhr = new ActiveXObject("Msxml2.XMLHTTP");
    					}
    					catch(e)
    					{
    						xhr = new ActiveXObject("Microsoft.XMLHTTP");
    					}
    				}
    				else // XMLHttpRequest non supporté par le navigateur 
    				{
    					alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest");
    					xhr = false;
    				}
     
    				return xhr;
    			}
     
    			function go_niveau()
    			{
    				var xhr = getXhr();
     
    				xhr.onreadystatechange = function()
    				{
    					if(xhr.readyState == 4 && xhr.status == 200)
    					{
    						leselect = xhr.responseText;
     
    						document.getElementById('niveau').innerHTML = leselect;
    					}
    				}
     
    				xhr.open("POST","menu_niveau.php",true);
     
    				xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
     
    				sel = document.getElementById('type');
     
    				id_type_formation_menu = sel.options[sel.selectedIndex].value;
     
    				xhr.send("id_type_formation_menu="+id_type_formation_menu);
    			}
     
    		</script>
     
    	</head>
     
    	<body>
     
    		<form>
     
    			<select name="type_formation" id="type" onchange="go_niveau()">
     
    				<option value="-1" selected="selected">Autre</option>
     
    				<?php
     
    					$Id = mysql_connect('localhost','root',"");
     
    					mysql_select_db("suiviautorisation",$Id);
     
    					$ReqSQL = "SELECT * FROM `type_formation_menu` ORDER BY `id_type_formation_menu`";
     
    					$Res = mysql_query($ReqSQL);
     
    					if($Res == false)
    					{
    						echo ("Erreur requete");
    					} 
    					while ($Ligne = mysql_fetch_array($Res))
    					{
    						echo("<option value=\"".$Ligne["id_type_formation_menu"]."\">".$Ligne["type_formation_menu"]."</option>");
    					}
     
    					mysql_close($Id);
     
    				?>
     
    			</select>
     
    			<div id="niveau">
     
    				<select name="niveau_formation">
     
    					<option value="-1" selected="selected">Autre</option>
     
    				</select>
     
    			</div>
     
    			<div id="specification">
     
    				<select name="specification_formation">
     
    					<option value="-1" selected="selected">Autre</option>
     
    				</select>
     
    			</div>
     
    		</form>
     
    	</body>
     
    </html>
    menu_niveau.php
    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
    <script>
     
    	function go_specification()
    	{
    		var xhr = getXhr();
     
    		xhr.onreadystatechange = function()
    		{
    			if(xhr.readyState == 4 && xhr.status == 200)
    			{
    				leselect = xhr.responseText;
     
    				document.getElementById('specification').innerHTML = leselect;
    			}
    		}
     
    		xhr.open("POST","menu_specification.php",true);
     
    		xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
     
    		sel = document.getElementById('niveau');
     
    		id_niveau_formation_menu = sel.options[sel.selectedIndex].value;
     
    		xhr.send("id_niveau_formation_menu="+id_niveau_formation_menu);
    	}
     
    </script>
     
    <?php
     
    	echo ("<select name=\"niveau_formation\" id=\"niveau\" onchange=\"go_specification()\">");
     
    	if(isset($_POST["id_type_formation_menu"]))
    	{
    		$id_type_formation_menu = $_POST["id_type_formation_menu"];
     
    		$Id = mysql_connect("localhost","root","");
     
    		mysql_select_db("suiviautorisation",$Id);
     
    		$ReqSQL = "SELECT * FROM `niveau_formation_menu` WHERE `id_type_formation_menu` = '$id_type_formation_menu' ORDER BY `id_niveau_formation_menu`";
     
    		$Res = mysql_query($ReqSQL);
     
    		if($Res == false)
    		{
    			echo ("Erreur requete");
    		} 
    		while ($Ligne = mysql_fetch_array($Res))
    		{
    			echo("<option value=\"".$Ligne["id_niveau_formation_menu"]."\">".$Ligne["niveau_formation_menu"]."</option>");
    		}
     
    		mysql_close($Id);
     
    	}
     
    	echo "</select>";
     
    ?>
    menu_specification.php
    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
    <?php
     
    	echo ("<select name=\"specification_formation\">");
     
    		if(isset($_POST["id_niveau_formation_menu"]))
    		{
    			$id_niveau_formation_menu = $_POST["id_niveau_formation_menu"];
     
    			$Id = mysql_connect("localhost","root","");
     
    			mysql_select_db("suiviautorisation",$Id);
     
    			$ReqSQL = "SELECT * FROM `specification_formation_menu` WHERE `id_niveau_formation_menu` = '$id_niveau_formation_menu' ORDER BY `id_specification_formation_menu`";
     
    			$Res = mysql_query($ReqSQL) or die(mysql_error());
     
    			if($Res == false)
    			{
    				echo ("Erreur requete");
    			} 
    			while ($Ligne = mysql_fetch_array($Res))
    			{
    				echo("<option value=\"".$Ligne["id_specification_formation_menu"]."\">".$Ligne["specification_formation_menu"]."</option>");
    			}
     
    			mysql_close($Id);
    		}
     
    	echo "</select>";
     
    ?>
    Merci de votre aide

  2. #2
    Expert éminent

    Homme Profil pro
    Inscrit en
    Janvier 2007
    Messages
    13 474
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Secteur : Finance

    Informations forums :
    Inscription : Janvier 2007
    Messages : 13 474
    Par défaut
    Bonjour,
    tu ne récupères pas le paramètre correctement (tu pointes sur le div, au lieu du select qu'il contient ):
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    sel = document.getElementById('niveau_formation');
    id_niveau_formation_menu = sel.options[sel.selectedIndex].value;
    xhr.send("id_niveau_formation_menu="+id_niveau_formation_menu);
    avec
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <select id="niveau_formation" name="niveau_formation">
    A+

  3. #3
    Membre averti
    Femme Profil pro
    ...
    Inscrit en
    Avril 2009
    Messages
    49
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : ...

    Informations forums :
    Inscription : Avril 2009
    Messages : 49
    Par défaut
    Mais en fait il pointait vers le bon endroit. En effet dans menu_niveau.php il y a
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    echo ("<select name=\"niveau_formation\" id=\"niveau\" onchange=\"go_specification()\">");
    juste avant le if. Le select de niveau est généré depuis menu_niveau.php. C'est sûrement un autre souci car même en mettant le même id partout comme tu me le conseille, cela ne change pas.

  4. #4
    Expert éminent

    Homme Profil pro
    Inscrit en
    Janvier 2007
    Messages
    13 474
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Secteur : Finance

    Informations forums :
    Inscription : Janvier 2007
    Messages : 13 474
    Par défaut
    Citation Envoyé par titinesaku Voir le message
    C'est sûrement un autre souci
    Dans ce cas, oui : ton id="niveau" est dupliqué (c'est déjà celui du div)

    A+

  5. #5
    Membre averti
    Femme Profil pro
    ...
    Inscrit en
    Avril 2009
    Messages
    49
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : ...

    Informations forums :
    Inscription : Avril 2009
    Messages : 49
    Par défaut
    Finalement en mettant les niveaux et spécifications dans le même fichier ça fonctionne. Pourtant il me reste un petit souci : j'aimerai pouvoir récupérer l'id_niveau (de la ligne 23, celui sélectionné par l'utilisateur) pour le mettre en condition dans les requêtes (exemple ligne 44) pour les spécifications. Voici le nouveau code :

    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
    <?php
     
    	echo ("<select name=\"niveau_formation\" id=\"niveau_formation\" onchange=\"go_specification()\">");
     
    	if(isset($_POST["id_type_formation_menu"]))
    	{
    		$id_type_formation_menu = $_POST["id_type_formation_menu"];
     
    		$Id = mysql_connect("localhost","root","");
     
    		mysql_select_db("suiviautorisation",$Id);
     
    		$ReqSQL = "SELECT * FROM `niveau_formation_menu` WHERE `id_type_formation_menu` = '$id_type_formation_menu' ORDER BY `id_niveau_formation_menu`";
     
    		$Res = mysql_query($ReqSQL);
     
    		if($Res == false)
    		{
    			echo ("Erreur requete");
    		} 
    		while ($Ligne = mysql_fetch_array($Res))
    		{
    			echo("<option value=\"".$Ligne["id_niveau_formation_menu"]."\">".$Ligne["niveau_formation_menu"]."</option>");
    		}
     
    		mysql_close($Id);
     
    	}
     
    	echo "</select><br/>";
     
    	echo ("<select name=\"specification_formation_1\">");
     
    	if(isset($_POST["id_type_formation_menu"]))
    	{
    		$id_type_formation_menu = $_POST["id_type_formation_menu"];
     
    		$Id = mysql_connect("localhost","root","");
     
    		mysql_select_db("suiviautorisation",$Id);
     
    		$ReqSQL = "SELECT * FROM `specification_formation_menu` 
    					WHERE `id_type_formation_menu` = '$id_type_formation_menu'
    					AND `id_niveau_formation_menu` = '$id_niveau_formation_menu'
    					ORDER BY `id_specification_formation_menu`";
     
    		$Res = mysql_query($ReqSQL);
     
    		if($Res == false)
    		{
    			echo ("Erreur requete");
    		} 
    		while ($Ligne = mysql_fetch_array($Res))
    		{
    			echo("<option value=\"".$Ligne["id_specification_formation_menu"]."\">".$Ligne["specification_formation_menu"]."</option>");
    		}
     
    		mysql_close($Id);
     
    	}
     
    	echo "</select><br/>";
     
    	echo ("<select name=\"specification_formation_2\">");
     
    	if(isset($_POST["id_type_formation_menu"]))
    	{
    		$id_type_formation_menu = $_POST["id_type_formation_menu"];
     
    		$Id = mysql_connect("localhost","root","");
     
    		mysql_select_db("suiviautorisation",$Id);
     
    		$ReqSQL = "SELECT * FROM `specification_formation_menu` 
    			WHERE `id_type_formation_menu` = '$id_type_formation_menu'
    			AND `id_niveau_formation_menu` = '$id_niveau_formation_menu'
    			ORDER BY `id_specification_formation_menu`";
     
    		$Res = mysql_query($ReqSQL);
     
    		if($Res == false)
    		{
    			echo ("Erreur requete");
    		} 
    		while ($Ligne = mysql_fetch_array($Res))
    		{
    			echo("<option value=\"".$Ligne["id_specification_formation_menu"]."\">".$Ligne["specification_formation_menu"]."</option>");
    		}
     
    		mysql_close($Id);
     
    	}
     
    	echo "</select><br/>";
     
    	echo ("<select name=\"specification_formation_3\">");
     
    	if(isset($_POST["id_type_formation_menu"]))
    	{
    		$id_type_formation_menu = $_POST["id_type_formation_menu"];
     
    		$Id = mysql_connect("localhost","root","");
     
    		mysql_select_db("suiviautorisation",$Id);
     
    		$ReqSQL = "SELECT * FROM `specification_formation_menu` 
    				WHERE `id_type_formation_menu` = '$id_type_formation_menu'
    				AND `id_niveau_formation_menu` = '$id_niveau_formation_menu'
    				ORDER BY `id_specification_formation_menu`";
     
    		$Res = mysql_query($ReqSQL);
     
    		if($Res == false)
    		{
    			echo ("Erreur requete");
    		} 
    		while ($Ligne = mysql_fetch_array($Res))
    		{
    			echo("<option value=\"".$Ligne["id_specification_formation_menu"]."\">".$Ligne["specification_formation_menu"]."</option>");
    		}
     
    		mysql_close($Id);
     
    	}
     
    	echo "</select>";
     
    ?>

  6. #6
    Expert éminent

    Homme Profil pro
    Inscrit en
    Janvier 2007
    Messages
    13 474
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Secteur : Finance

    Informations forums :
    Inscription : Janvier 2007
    Messages : 13 474
    Par défaut
    Si tu te retrouves toujours avec 2 id="niveau" dans ta page, tu auras quand même des problèmes ...

    A+

  7. #7
    Membre averti
    Femme Profil pro
    ...
    Inscrit en
    Avril 2009
    Messages
    49
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : ...

    Informations forums :
    Inscription : Avril 2009
    Messages : 49
    Par défaut
    Mais il n'y a plus les deux id identiques, voila maintenant la situation dans laquelle je suis : j'ai une formulaire dans lequel j'ai inséré l'ajax, cependant quand je change le type (dans le select), les listes liees apparaissent en haut de la page.

    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
    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
    376
    377
    378
    <?php
            
            session_start();
            
            if(isset($_SESSION['login_connexion']) && !empty($_SESSION['login_connexion']))
            {
                    
                    ?>
     
    		<html>
     
    			<head>
     
    				<title>Inscription dans la base</title>
     
    				<script type='text/javascript'>
     
    					function getXhr()
    					{
    						var xhr = null;
     
    						if(window.XMLHttpRequest)// Firefox et autres
    						{
    							xhr = new XMLHttpRequest(); 
    						}
    						else if(window.ActiveXObject)// Internet Explorer 
    						{
    							try
    							{
    								xhr = new ActiveXObject("Msxml2.XMLHTTP");
    							}
    							catch(e)
    							{
    								xhr = new ActiveXObject("Microsoft.XMLHTTP");
    							}
    						}
    						else // XMLHttpRequest non supporté par le navigateur 
    						{
    							alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest");
    							xhr = false;
    						}
     
    						return xhr;
    					}
     
    					function go_niveau()
    					{
    						var xhr = getXhr();
     
    						xhr.onreadystatechange = function()
    						{
    							if(xhr.readyState == 4 && xhr.status == 200)
    							{
    								leselect = xhr.responseText;
     
    								document.getElementById('niveau').innerHTML = leselect;
    							}
    						}
     
    						xhr.open("POST","menu_niveau.php",true);
     
    						xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
     
    						sel = document.getElementById('type');
     
    						id_type_formation_menu = sel.options[sel.selectedIndex].value;
     
    						xhr.send("id_type_formation_menu="+id_type_formation_menu);
    					}
     
    				</script>
     
    			</head>
     
    			<body>
     
    				<h3>Cr&eacute;ation de la fiche</h3>
     
    				<form action="enregistrement.php" method="POST">
     
    					<table>
     
    						<tr>
    							<td><h4>Renseignements personnels</h4></td>
    						</tr>
     
    						<tr>
    							<td>Nom : </td>
    							<td><input type="text" name="nom_personne"/></td>
    						</tr>
     
    						<tr>
    							<td>Pr&eacute;nom : </td>
    							<td><input type="text" name="prenom_personne"/></td>
    						</tr>
     
    						<tr>
     
    							<td>Date de naissance : </td>
     
    							<td>
     
    								<select name="jour_naissance_personne">
    									<?php
                                                                                    for($j=1 ; $j<32 ; $j++)
                                                                                    {
                                                                                            echo("<option value=\"$j\">$j</option>");
                                                                                    }
                                                                            ?>
    								</select>
     
    								/ 
    								<select name="mois_naissance_personne">
    									<?php
                                                                                    for($m=1 ; $m<13 ; $m++)
                                                                                    {
                                                                                            echo("<option value=\"$m\">$m</option>");
                                                                                    }
                                                                            ?>
    								</select>
     
    								/  
    								<select name="annee_naissance_personne">
    									<?php
                                                                                    for($a=1944 ; $a<1995 ; $a++)
                                                                                    {
                                                                                            echo("<option value=\"$a\">$a</option>");
                                                                                    }
                                                                            ?>
    								</select>
     
    							</td>
     
    						</tr>
     
    						<tr>
     
    							<td>Qualification : </td>
     
    							<td><input type="text" name="qualification_personne"/></td>
     
    						</tr>
     
    						<tr>
     
    							<td>Photo : </td>
     
    							<td><input type="file" name="photo_personne"/></td>
     
    						</tr>
     
    						<tr>
     
    							<td><br/><h4>Renseignements sur la formation</h4></td>
     
    						</tr>
     
    						<tr>
     
    							<td>Type : </td>
     
    							<td>
     
    								<select name="type_formation" id="type" onchange="go_niveau()">
     
    									<option value="-1" selected="selected">-- Choisir un type --</option>
     
    									<?php
     
    										$Id = mysql_connect('localhost','root',"");
     
    										mysql_select_db("suiviautorisation",$Id);
     
    										$ReqSQL = "SELECT * FROM `type_formation_menu` ORDER BY `id_type_formation_menu`";
     
    										$Res = mysql_query($ReqSQL);
     
    										if($Res == false)
    										{
    											echo ("Erreur requete");
    										} 
    										while ($Ligne = mysql_fetch_array($Res))
    										{
    											echo("<option value=\"".$Ligne["id_type_formation_menu"]."\">".$Ligne["type_formation_menu"]."</option>");
    										}
     
    										mysql_close($Id);
     
    									?>
     
    								</select>
     
    							</td>
     
    						</tr>
     
    						<div id="niveau">
     
    							<tr>
     
    								<td>Niveau : </td>
     
    								<td>
     
    									<select name="niveau_formation">
     
    										<option value="-1" selected="selected">-- Choisir un niveau --</option>
     
    									</select>
     
    								</td>
     
    							</tr>
     
    							<tr>
     
    								<td>Sp&eacute;cification : </td>
     
    								<td>
     
    									<select name="specification_formation_1">
     
    										<option value="-1" selected="selected">-- Choisir une sp&eacute;cification --</option>
     
    									</select>
     
    								</td>
     
    							</tr>
     
    							<tr>
     
    								<td>Sp&eacute;cification : </td>
     
    								<td>
     
    									<select name="specification_formation_2">
     
    										<option value="-1" selected="selected">-- Choisir une sp&eacute;cification --</option>
     
    									</select>
     
    								</td>
     
    							</tr>
     
    							<tr>
     
    								<td>Sp&eacute;cification : </td>
     
    								<td>
     
    									<select name="specification_formation_3">
     
    										<option value="-1" selected="selected">-- Choisir une sp&eacute;cification --</option>
     
    									</select>
     
    								</td>
     
    							</tr>
     
    						</div>
     
    						<tr>
     
    							<td>Date de formation : </td>
    							<td>
    								<select name="jour_formation">
    									<?php
                                                                                    for($j=1 ; $j<32 ; $j++)
                                                                                    {
                                                                                            echo("<option value=\"$j\">$j</option>");
                                                                                    }
                                                                            ?>
    								</select>
     
    								/
    								<select name="mois_formation">
    									<?php
                                                                                    for($m=1 ; $m<13 ; $m++)
                                                                                    {
                                                                                            echo("<option value=\"$m\">$m</option>");
                                                                                    }
                                                                            ?>
    								</select>
     
    								/
    								<select name="annee_formation">
    									<?php
                                                                                    for($a=1980 ; $a<2010 ; $a++)
                                                                                    {
                                                                                            echo("<option value=\"$a\">$a</option>");
                                                                                    }
                                                                            ?>
    								</select>
     
    							</td>
     
    						</tr>
     
    						<tr>
     
    							<td>Dur&eacute;e de validit&eacute; ( en ann&eacute;es ) : </td>
    							<td><input type="text" name="validite_formation"/></td>
     
    						</tr>
     
    						<tr>
     
    							<td>Fin de validit&eacute; : </td>
    							<td><input type="text" name="fin_validite" disabled="disabled" /></td>
     
    						</tr>
     
    						<tr>
     
    							<td>Lieu de formation : </td>
    							<td><input type="text" name="lieu_formation"/></td>
     
    						</tr>
     
    						<tr>
     
    							<td>Organisme &eacute;valuateur : </td>
    							<td><input type="text" name="organisme_evaluateur_formation"/></td>
     
    						</tr>
     
    						<tr>
    							<td><br/><h4>Renseignements sur l'entreprise</h4></td>
    						</tr>
     
    						<tr>
     
    							<td>Nom de la soci&eacute;t&eacute; : </td>
    							<td><input type="text" name="nom_societe"/></td>
     
    						</tr>
     
    						<tr>
     
    							<td>Nom de l'employeur : </td>
    							<td><input type="text" name="nom_employeur_societe"/></td>
     
    						</tr>
     
    					</table>
     
    					<table>
     
    						<tr>
    							<td>
    								<br/><a href="../index.php">Retour</a>
    								<input type="reset"/>
    								<input type="submit" value="Enregistrer"/>
    							</td>
    						</tr>
     
    					</table>
     
    					<br/><br/><a href="deconnexion.php">D&eacute;connexion</a>
     
    				</form>
     
    			</body>
     
    		</html>
     
    		<?php
                    
            }
            else
            {
                    header("Location: ../index.php");
            }
            
    ?>
    menu_niveau.php
    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
    <?php
     
    	echo ("<select name=\"niveau_formation\" id=\"niveau\" onchange=\"go_specification()\">");
     
    	if(isset($_POST["id_type_formation_menu"]))
    	{
    		$id_type_formation_menu = $_POST["id_type_formation_menu"];
     
    		$Id = mysql_connect("localhost","root","");
     
    		mysql_select_db("suiviautorisation",$Id);
     
    		$ReqSQL = "SELECT * FROM `niveau_formation_menu` WHERE `id_type_formation_menu` = '$id_type_formation_menu' ORDER BY `id_niveau_formation_menu`";
     
    		$Res = mysql_query($ReqSQL);
     
    		if($Res == false)
    		{
    			echo ("Erreur requete");
    		} 
    		while ($Ligne = mysql_fetch_array($Res))
    		{
    			echo("<option value=\"".$Ligne["id_niveau_formation_menu"]."\">".$Ligne["niveau_formation_menu"]."</option>");
    		}
     
    		mysql_close($Id);
     
    	}
     
    	echo "</select><br/>";
     
    	echo ("<select name=\"specification_formation_1\">");
     
    	if(isset($_POST["id_type_formation_menu"]))
    	{
    		$id_type_formation_menu = $_POST["id_type_formation_menu"];
     
    		$Id = mysql_connect("localhost","root","");
     
    		mysql_select_db("suiviautorisation",$Id);
     
    		$ReqSQL = "SELECT * FROM `specification_formation_menu` 
    					WHERE `id_type_formation_menu` = '$id_type_formation_menu'
     
    					ORDER BY `id_specification_formation_menu`";
     
    		$Res = mysql_query($ReqSQL);
     
    		if($Res == false)
    		{
    			echo ("Erreur requete");
    		} 
    		while ($Ligne = mysql_fetch_array($Res))
    		{
    			echo("<option value=\"".$Ligne["id_specification_formation_menu"]."\">".$Ligne["specification_formation_menu"]."</option>");
    		}
     
    		mysql_close($Id);
     
    	}
     
    	echo "</select><br/>";
     
    	echo ("<select name=\"specification_formation_2\">");
     
    	if(isset($_POST["id_type_formation_menu"]))
    	{
    		$id_type_formation_menu = $_POST["id_type_formation_menu"];
     
    		$Id = mysql_connect("localhost","root","");
     
    		mysql_select_db("suiviautorisation",$Id);
     
    		$ReqSQL = "SELECT * FROM `specification_formation_menu` 
    			WHERE `id_type_formation_menu` = '$id_type_formation_menu'
    			AND `id_niveau_formation_menu` = '$id_niveau_formation_menu'
    			ORDER BY `id_specification_formation_menu`";
     
    		$Res = mysql_query($ReqSQL);
     
    		if($Res == false)
    		{
    			echo ("Erreur requete");
    		} 
    		while ($Ligne = mysql_fetch_array($Res))
    		{
    			echo("<option value=\"".$Ligne["id_specification_formation_menu"]."\">".$Ligne["specification_formation_menu"]."</option>");
    		}
     
    		mysql_close($Id);
     
    	}
     
    	echo "</select><br/>";
     
    	echo ("<select name=\"specification_formation_3\">");
     
    	if(isset($_POST["id_type_formation_menu"]))
    	{
    		$id_type_formation_menu = $_POST["id_type_formation_menu"];
     
    		$Id = mysql_connect("localhost","root","");
     
    		mysql_select_db("suiviautorisation",$Id);
     
    		$ReqSQL = "SELECT * FROM `specification_formation_menu` 
    				WHERE `id_type_formation_menu` = '$id_type_formation_menu'
    				AND `id_niveau_formation_menu` = '$id_niveau_formation_menu'
    				ORDER BY `id_specification_formation_menu`";
     
    		$Res = mysql_query($ReqSQL);
     
    		if($Res == false)
    		{
    			echo ("Erreur requete");
    		} 
    		while ($Ligne = mysql_fetch_array($Res))
    		{
    			echo("<option value=\"".$Ligne["id_specification_formation_menu"]."\">".$Ligne["specification_formation_menu"]."</option>");
    		}
     
    		mysql_close($Id);
     
    	}
     
    	echo "</select>";
     
    ?>

  8. #8
    Membre averti
    Femme Profil pro
    ...
    Inscrit en
    Avril 2009
    Messages
    49
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : ...

    Informations forums :
    Inscription : Avril 2009
    Messages : 49
    Par défaut
    Je ne m'en sort vraiment pas avec ce code, et c'est pas faute de chercher
    Il y a aussi le fait que les listes s'affichent en haut de la page ce qui donne ça :
    Images attachées Images attachées  

  9. #9
    Membre averti
    Femme Profil pro
    ...
    Inscrit en
    Avril 2009
    Messages
    49
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : ...

    Informations forums :
    Inscription : Avril 2009
    Messages : 49
    Par défaut
    J'ai trouvé pourquoi les listes s'affichaient ainsi. En fait elles ne sont pas bien gérées quand elles sont placées dans un tableau (chaque liste dans un td), la liaison se fait mais les listes sont dupliquées. J'ai remédié au problème en plaçant des fieldset sur mon formulaire et en zappant le tableau juste sur la partie des listes. Voici mon nouveau code :

    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
    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
    <?php
            
            session_start();
            
            if(isset($_SESSION['login_connexion']) && !empty($_SESSION['login_connexion']))
            {
                    
                    ?>
     
    		<html>
     
    			<head>
     
    				<title>Inscription dans la base</title>
     
    				<script type='text/javascript'>
     
    					function getXhr()
    					{
    						var xhr = null;
     
    						if(window.XMLHttpRequest)// Firefox et autres
    						{
    							xhr = new XMLHttpRequest(); 
    						}
    						else if(window.ActiveXObject)// Internet Explorer 
    						{
    							try
    							{
    								xhr = new ActiveXObject("Msxml2.XMLHTTP");
    							}
    							catch(e)
    							{
    								xhr = new ActiveXObject("Microsoft.XMLHTTP");
    							}
    						}
    						else // XMLHttpRequest non supporté par le navigateur 
    						{
    							alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest");
    							xhr = false;
    						}
     
    						return xhr;
    					}
     
    					function go_niveau()
    					{
    						var xhr = getXhr();
     
    						xhr.onreadystatechange = function()
    						{
    							if(xhr.readyState == 4 && xhr.status == 200)
    							{
    								leselect = xhr.responseText;
     
    								document.getElementById('n').innerHTML = leselect;
    							}
    						}
     
    						xhr.open("POST","menu_niveau.php",true);
     
    						xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
     
    						sel = document.getElementById('type');
     
    						id_type_formation_menu = sel.options[sel.selectedIndex].value;
     
    						xhr.send("id_type_formation_menu="+id_type_formation_menu);
    					}
     
    				</script>
     
    			</head>
     
    			<body>
     
    				<h3>Cr&eacute;ation de la fiche</h3>
     
    				<form action="enregistrement.php" method="POST">
     
    					<fieldset style="width:900px;">
     
    						<legend>Renseignements personnels</legend>
     
    						<table>
     
    							<tr>
     
    								<td>Nom : </td>
    								<td><input type="text" name="nom_personne"/></td>
     
    							</tr>
     
    							<tr>
     
    								<td>Pr&eacute;nom : </td>
    								<td><input type="text" name="prenom_personne"/></td>
     
    							</tr>
     
    							<tr>
     
    								<td>Date de naissance : </td>
    								<td>
     
    									<select name="jour_naissance_personne">
    										<?php
                                                                                            for($j=1 ; $j<32 ; $j++)
                                                                                            {
                                                                                                    echo("<option value=\"$j\">$j</option>");
                                                                                            }
                                                                                    ?>
    									</select>
     
    									/ 
    									<select name="mois_naissance_personne">
    										<?php
                                                                                            for($m=1 ; $m<13 ; $m++)
                                                                                            {
                                                                                                    echo("<option value=\"$m\">$m</option>");
                                                                                            }
                                                                                    ?>
    									</select>
     
    									/  
    									<select name="annee_naissance_personne">
    										<?php
                                                                                            for($a=1944 ; $a<1995 ; $a++)
                                                                                            {
                                                                                                    echo("<option value=\"$a\">$a</option>");
                                                                                            }
                                                                                    ?>
    									</select>
     
    								</td>
     
    							</tr>
     
    							<tr>
     
    								<td>Qualification : </td>
    								<td><input type="text" name="qualification_personne"/></td>
     
    							</tr>
     
    							<tr>
     
    								<td>Photo : </td>
    								<td><input type="file" name="photo_personne"/></td>
     
    							</tr>
     
    						</table>
     
    					</fieldset>
     
    					<br/>
     
    					<fieldset style="width:900px;">
     
    						<legend>Renseignements sur la formation</legend>
     
    						Type : 
     
    						<select name="type_formation" id="type" onchange="go_niveau()">
     
    							<?php
     
    								$Id = mysql_connect('localhost','root',"");
     
    								mysql_select_db("suiviautorisation",$Id);
     
    								$ReqSQL = "SELECT * FROM `type_formation_menu` ORDER BY `id_type_formation_menu`";
     
    								$Res = mysql_query($ReqSQL);
     
    								if($Res == false)
    								{
    									echo ("Erreur requete");
    								} 
    								while ($Ligne = mysql_fetch_array($Res))
    								{
    									echo("<option value=\"".$Ligne["id_type_formation_menu"]."\">".$Ligne["type_formation_menu"]."</option>");
    								}
     
    								mysql_close($Id);
     
    							?>
     
    						</select>
     
    						<div id="n">
     
    							Niveau : 
     
    							<select name="niveau_formation">
     
    								<option value="-1" selected="selected">-- Choisir un niveau --</option>
     
    							</select>
     
    							<br/>
     
    							Sp&eacute;cification : 
     
    							<select name="specification_formation_1">
     
    								<option value="-1" selected="selected">-- Choisir une sp&eacute;cification --</option>
     
    							</select>
     
    							<br/>
     
    							Sp&eacute;cification : 
     
    							<select name="specification_formation_2">
     
    								<option value="-1" selected="selected">-- Choisir une sp&eacute;cification --</option>
     
    							</select>
     
    							<br/>
     
    							Sp&eacute;cification : 
     
    							<select name="specification_formation_3">
     
    								<option value="-1" selected="selected">-- Choisir une sp&eacute;cification --</option>
     
    							</select>
     
    						</div>
     
    						<table>
     
    							<tr>
     
    								<td>Date de formation : </td>
    								<td>
     
    									<select name="jour_formation">
    										<?php
                                                                                            for($j=1 ; $j<32 ; $j++)
                                                                                            {
                                                                                                    echo("<option value=\"$j\">$j</option>");
                                                                                            }
                                                                                    ?>
    									</select>
     
    									/
    									<select name="mois_formation">
    										<?php
                                                                                            for($m=1 ; $m<13 ; $m++)
                                                                                            {
                                                                                                    echo("<option value=\"$m\">$m</option>");
                                                                                            }
                                                                                    ?>
    									</select>
     
    									/
    									<select name="annee_formation">
    										<?php
                                                                                            for($a=1980 ; $a<2010 ; $a++)
                                                                                            {
                                                                                                    echo("<option value=\"$a\">$a</option>");
                                                                                            }
                                                                                    ?>
    									</select>
     
    								</td>
     
    							</tr>
     
    							<tr>
     
    								<td>Dur&eacute;e de validit&eacute; ( en ann&eacute;es ) : </td>
    								<td><input type="text" name="validite_formation"/></td>
     
    							</tr>
     
    							<tr>
     
    								<td>Fin de validit&eacute; : </td>
    								<td><input type="text" name="fin_validite" disabled="disabled" /></td>
     
    							</tr>
     
    							<tr>
     
    								<td>Lieu de formation : </td>
    								<td><input type="text" name="lieu_formation"/></td>
     
    							</tr>
     
    							<tr>
     
    								<td>Organisme &eacute;valuateur : </td>
    								<td><input type="text" name="organisme_evaluateur_formation"/></td>
     
    							</tr>
     
    						</table>
     
    					</fieldset>
     
    					<br/>
     
    					<fieldset style="width:900px;">
     
    						<legend>Renseignements sur l'entreprise</legend>
     
    						<table>
     
    							<tr>
     
    								<td>Nom de la soci&eacute;t&eacute; : </td>
    								<td><input type="text" name="nom_societe"/></td>
     
    							</tr>
     
    							<tr>
     
    								<td>Nom de l'employeur : </td>
    								<td><input type="text" name="nom_employeur_societe"/></td>
     
    							</tr>
     
    						</table>
     
    					</fieldset>
     
    					<table>
     
    						<tr>
    							<td>
    								<br/><a href="../index.php">Retour</a>
    								<input type="reset"/>
    								<input type="submit" value="Enregistrer"/>
    							</td>
    						</tr>
     
    					</table>
     
    					<br/><br/><a href="deconnexion.php">D&eacute;connexion</a>
     
    				</form>
     
    			</body>
     
    		</html>
     
    		<?php
                    
            }
            else
            {
                    header("Location: ../index.php");
            }
            
    ?>
    et le menu_niveau.php
    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
    <?php
     
    	echo ("Niveau : <select name=\"niveau_formation\" id=\"niveau_formation\" onchange=\"go_specification()\">");
     
    	if(isset($_POST["id_type_formation_menu"]))
    	{
    		$id_type_formation_menu = $_POST["id_type_formation_menu"];
     
    		$Id = mysql_connect("localhost","root","");
     
    		mysql_select_db("suiviautorisation",$Id);
     
    		$ReqSQL = "SELECT * FROM `niveau_formation_menu` WHERE `id_type_formation_menu` = '$id_type_formation_menu' ORDER BY `id_niveau_formation_menu`";
     
    		$Res = mysql_query($ReqSQL);
     
    		if($Res == false)
    		{
    			echo ("Erreur requete");
    		} 
    		while ($Ligne = mysql_fetch_array($Res))
    		{
    			echo("<option value=\"".$Ligne["id_niveau_formation_menu"]."\">".$Ligne["niveau_formation_menu"]."</option>");
    		}
     
    		mysql_close($Id);
     
    	}
     
    	echo "</select><br/>";
     
    	echo ("Sp&eacute;cification : <select name=\"specification_formation_1\">");
     
    	if(isset($_POST["id_type_formation_menu"]))
    	{
    		$id_type_formation_menu = $_POST["id_type_formation_menu"];
     
    		$Id = mysql_connect("localhost","root","");
     
    		mysql_select_db("suiviautorisation",$Id);
     
    		$ReqSQL = "SELECT * FROM `specification_formation_menu` 
    					WHERE `id_type_formation_menu` = '$id_type_formation_menu'
    					ORDER BY `id_specification_formation_menu`";
     
    		$Res = mysql_query($ReqSQL);
     
    		if($Res == false)
    		{
    			echo ("Erreur requete");
    		} 
    		while ($Ligne = mysql_fetch_array($Res))
    		{
    			echo("<option value=\"".$Ligne["id_specification_formation_menu"]."\">".$Ligne["specification_formation_menu"]."</option>");
    		}
     
    		mysql_close($Id);
     
    	}
     
    	echo "</select><br/>";
     
    	echo ("Sp&eacute;cification : <select name=\"specification_formation_2\">");
     
    	if(isset($_POST["id_type_formation_menu"]))
    	{
    		$id_type_formation_menu = $_POST["id_type_formation_menu"];
     
    		$Id = mysql_connect("localhost","root","");
     
    		mysql_select_db("suiviautorisation",$Id);
     
    		$ReqSQL = "SELECT * FROM `specification_formation_menu` 
    			WHERE `id_type_formation_menu` = '$id_type_formation_menu'
    			ORDER BY `id_specification_formation_menu`";
     
    		$Res = mysql_query($ReqSQL);
     
    		if($Res == false)
    		{
    			echo ("Erreur requete");
    		} 
    		while ($Ligne = mysql_fetch_array($Res))
    		{
    			echo("<option value=\"".$Ligne["id_specification_formation_menu"]."\">".$Ligne["specification_formation_menu"]."</option>");
    		}
     
    		mysql_close($Id);
     
    	}
     
    	echo "</select><br/>";
     
    	echo ("Sp&eacute;cification : <select name=\"specification_formation_3\">");
     
    	if(isset($_POST["id_type_formation_menu"]))
    	{
    		$id_type_formation_menu = $_POST["id_type_formation_menu"];
     
    		$Id = mysql_connect("localhost","root","");
     
    		mysql_select_db("suiviautorisation",$Id);
     
    		$ReqSQL = "SELECT * FROM `specification_formation_menu` 
    				WHERE `id_type_formation_menu` = '$id_type_formation_menu'
    				ORDER BY `id_specification_formation_menu`";
     
    		$Res = mysql_query($ReqSQL);
     
    		if($Res == false)
    		{
    			echo ("Erreur requete");
    		} 
    		while ($Ligne = mysql_fetch_array($Res))
    		{
    			echo("<option value=\"".$Ligne["id_specification_formation_menu"]."\">".$Ligne["specification_formation_menu"]."</option>");
    		}
     
    		mysql_close($Id);
     
    	}
     
    	echo "</select>";
     
    ?>
    Cependant cela ne règle toujours pas mon problème : dans le menu_niveau.php je souhaiterais récupérer l'id_niveau_formation qui a été sélectionné pour pouvoir l'intégrer en condition dans ma requête concernant les spécifications (plus bas dans le même script) Vous auriez une idée ?

  10. #10
    Membre averti
    Femme Profil pro
    ...
    Inscrit en
    Avril 2009
    Messages
    49
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : ...

    Informations forums :
    Inscription : Avril 2009
    Messages : 49
    Par défaut
    Bonjour,

    Je n'ai toujours pas trouvé de solution pour récupérer l'id_niveau_formation Je sens que je vais devoir tout revoir

  11. #11
    Membre averti
    Femme Profil pro
    ...
    Inscrit en
    Avril 2009
    Messages
    49
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : ...

    Informations forums :
    Inscription : Avril 2009
    Messages : 49
    Par défaut
    Finalement je me suis débrouillé toute seule comme une grande et tout fonctionne parfaitement. Merci quand même

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [AJAX] 3 liste lièes en Ajax dont une qui reste vide
    Par mimotin dans le forum Général JavaScript
    Réponses: 0
    Dernier message: 19/08/2008, 20h40
  2. [AJAX] Trois listes liées
    Par jason69 dans le forum Général JavaScript
    Réponses: 2
    Dernier message: 30/03/2007, 20h23
  3. [AJAX] plusieurs listes liées
    Par highman dans le forum Général JavaScript
    Réponses: 7
    Dernier message: 02/03/2007, 10h31
  4. [AJAX] Listes liées
    Par oranocha dans le forum Général JavaScript
    Réponses: 1
    Dernier message: 13/02/2007, 06h59
  5. [AJAX] Restaurer l'état de listes liées par Ajax
    Par vallica dans le forum Général JavaScript
    Réponses: 3
    Dernier message: 27/10/2006, 13h36

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo