Bonjour � vous !

Bon voil� mon probl�me :

J'ai une page o� j'affiche des tableaux r�sultant d'une extraction de BDD voici le code :

Code html : 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
<!DOCTYPE html>
<html>
<head>
<?php
 
 
$bdd = new PDO('mysql:host=localhost;dbname=direct nil;charset=utf8', 'root', '');
 
setlocale(LC_TIME, "fr_FR");
echo strftime("%k");
 
?>
 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="Oui.css">
<div id="overlay" class="calque"></div>
<div id="window" class="window"><iframe class = "contemp_window" id = "contempwindow" name = "contempwindow"></iframe></div>
 
</head>
<body> 
 
<div id="GARE_0_tab" style="width:1000px;height: 470px; overflow: auto; border: 1px solid black;position:absolute;top:30px;visibility:hidden;">
	<table>
		<tbody id="liste" style="text-align:center;">
			<tr style="border-bottom: 1px solid black">
				<th>H</th>
				<th>REF</th>
				<th>QT</th>
				<th>GARE</th>
				<th>STATUT</th>
			</tr>
 
			<?php $req = $bdd->query("SELECT * FROM kanban2 WHERE NOT STATUT = 'TRAITE'");
                        $i=0;
                        while($donnees = $req->fetch()) { ?>
 
			<tr <?php echo "id='tr_$i'"?> >
				<td <?php echo "id='td_1_$i'"?> > <?php echo $donnees['H']; ?></td>
				<td <?php echo "id='td_2_$i'"?> > <?php echo $donnees['REF']; ?></td>
				<td <?php echo "id='td_3_$i'"?> > <?php echo $donnees['QT']; ?></td>
				<td <?php echo "id='td_4_$i'"?> > <?php echo $donnees['GARE']; ?></td>
				<td <?php echo "id='td_5_$i'"?> > <?php echo $donnees['STATUT']; ?></td>
				<?php echo "<td><input id='champ_$i' type='radio' name='blabla'>"; ?>
			</tr>
 
			<?php $i++; } $req->closeCursor();
                        unset($bdd);
                        ?> 
 
		</tbody>
	</table>
</div>
 
<div id="H1_tab" style="width:1000px;height: 470px; overflow: auto; border: 1px solid black;position:absolute;top:30px;visibility:hidden;">
	<table>
		<tbody id="liste" style="text-align:center;">
			<tr style="border-bottom: 1px solid black">
				<th>H</th>
				<th>REF</th>
				<th>QT</th>
				<th>GARE</th>
				<th>STATUT</th>
			</tr>
 
			<?php 
                        $bdd = new PDO('mysql:host=localhost;dbname=direct nil;charset=utf8', 'root', '');
                        $req = $bdd->query("SELECT * FROM kanban2 WHERE NOT STATUT = 'TRAITE'");
                        $i=0;
                        while($donnees = $req->fetch()) { ?>
 
			<tr <?php echo "id='tr_$i'"?> >
				<td <?php echo "id='td_1_$i'"?> > <?php echo $donnees['H']; ?></td>
				<td <?php echo "id='td_2_$i'"?> > <?php echo $donnees['REF']; ?></td>
				<td <?php echo "id='td_3_$i'"?> > <?php echo $donnees['QT']; ?></td>
				<td <?php echo "id='td_4_$i'"?> > <?php echo $donnees['GARE']; ?></td>
				<td <?php echo "id='td_5_$i'"?> > <?php echo $donnees['STATUT']; ?></td>
				<?php echo "<td><input id='champ_$i' type='radio' name='blabla'>"; ?>
			</tr>
 
			<?php $i++; } 
                        $req->closeCursor();
                        unset($bdd);
                        ?> 
 
		</tbody>
	</table>
</div>
</body>
</html>

Toutes mes tables sont identiques pour le moment (il s'agit d'une phase de test) seul l'id de la <div> change � chaque fois.

Le <style> avec position: absolute est voulu, je veux superposer tous ces tableaux et juste en afficher un selon (et cacher les autres) selon le contenu de la liste d�roulante :
Code html : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
8
9
10
<SELECT class="liste_der" id="gare_dep" name="gare" size="1" onClick="test()">
			<OPTION selected>Choisir gare
			<OPTION>GARE 0
			<OPTION>G1
			<OPTION>H1
			<OPTION>J1
			<OPTION>J0
			<OPTION>H0
			<OPTION>J2
			</SELECT>

Pour g�rer cela j'ai la fonction JS "test()" que voila :

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
function test(){
	var kjj = document.getElementById("gare_dep").value;
 
	if(kjj=='GARE 0'){
		document.getElementById("GARE_0_tab").style.visibility = "visible";
		document.getElementById("G1_tab").style.visibility = "hidden";
		document.getElementById("H1_tab").style.visibility = "hidden";
		document.getElementById("J1_tab").style.visibility = "hidden";
		document.getElementById("J0_tab").style.visibility = "hidden";
		document.getElementById("H0_tab").style.visibility = "hidden";
		document.getElementById("J2_tab").style.visibility = "hidden";
 
	}
	if(kjj=='H1'){
		document.getElementById("GARE_0_tab").style.visibility = "hidden";
		document.getElementById("G1_tab").style.visibility = "hidden";
		document.getElementById("H1_tab").style.visibility = "visible";
		document.getElementById("J1_tab").style.visibility = "hidden";
		document.getElementById("J0_tab").style.visibility = "hidden";
		document.getElementById("H0_tab").style.visibility = "hidden";
		document.getElementById("J2_tab").style.visibility = "hidden";
 
	}
}
J'ai r�duit volontairement la fonction pour l'affichage, au d�but j'ai cr�� un switch mais celui-ci ne marchait pas alors j'ai essay� �a mais l� non plus la fonction marche pas.

Je tiens � pr�ciser que la fonction marche correctement pour le premier cas (le premier de la fonction comme si le reste �tait ignor�) quand la liste d�roulante est sur "GARE 0" la table avec <id> "GARE_0_tab" s'affiche mais lorsque je mets la liste � H1 la table avec <id> "H1_tab" s'affiche pas (mais l'autre se "cache" bien).

Quelqu'un a-t-il une id�e du probl�me ?

Merci d'avance.