Page 1 sur 1
affichage d'une selection
Posté : 10 avr. 2014, 12:53
par saminfo
Bonjour a tous
s'il vous plait j'ai un tableau qui contient une liste de tous les employés de ma table "employé" en affichant ses attributs "matricule, nom, prenom, fonction"
et je veux mettre le matricule en lien, une fois cliquer sur le matricule d'un tel employé j'aimerais avoir toutes les informations de l'emplyé selectioné.
svp je suis perdu, je ne sais pas comment faire
merci et bonne journée
Re: affichage d'une selection
Posté : 10 avr. 2014, 14:38
par moogli
salut,
un paramètre d'url ce récupère dans la variable $_GET.
si le paramètre s'appel toto tu aura un index toto => $_GET['toto'];
A partir de la un simple select sur la table employé avec le matricule dans le prédicat (where matricule = la valeur de l'url) et le tour est joué.
l'url peux être, par exemple, detailEmploye.php?matricule=xxxx où xx est la valeur récupérée dans ta première requête.
@+
Re: affichage d'une selection
Posté : 10 avr. 2014, 15:08
par saminfo
Merci beaucoup pour votre réponse
excusé moi j'ai pas bien compris
es que c'est possible de me donner un exemple ou expliqué plus.
merci et je m'excuse
bonne journée
Re: affichage d'une selection
Posté : 10 avr. 2014, 15:26
par saminfo
salut
svp je vous passe le code de ma page d'affichage du tableau qui contient tous les employés
afficheemploye.php
<?php
$serveur=mysql_connect('127.0.0.1','root','');
$db= mysql_select_db('bdd', $serveur);
$requete="SELECT * FROM employee,departement,station where employee.nom_dprt=departement.nom_dprt and departement.adr_sta=station.adr_sta order by nom_emp";
$resultat=mysql_query($requete);
$empl=mysql_fetch_array($resultat);
?>
<html>
<head>
<style>
.table {}
.table th{ background:#fffdfa url(images/th.gif) repeat-x 0 0; color:#818181; text-align: left; padding:7px 10px; border-bottom:solid 1px #d2d1cb;}
.table td{ background:#fbfcfc; border-bottom:solid 1px #e0e0e0; padding:8px 10px; }
.table tr.odd td{ background:#f8f8f8; }
.table tr:hover td{ background:#fff9e1; }
.table a.ico{ }
</style>
</head>
<body>
<table width="1019" border="0" cellpadding="1" align="center" class="table">
<tr>
<th scope="col">Nom</th>
<th scope="col">Prénom</th>
<th scope="col">Fonction</th>
<th scope="col">Service</th>
<th scope="col">Département</th>
<th scope="col">Station</th>
</tr>
<?php do { ?>
<tr>
<td class="tda"> <?php echo $empl['nom_emp']; ?></td>
<td class="tda"> <?php echo $empl['prenom_emp']; ?> </td>
<td class="tda"> <?php echo $empl['fct_actu']; ?></td>
<td class="tda"> <?php echo $empl['service']; ?></td>
<td class="tda"> <?php echo $empl['nom_dprt']; ?></td>
<td class="tda"> <?php echo $empl['adr_sta']; ?></td>
<td class="tda"><a href="#"> <input name="" type="image" src="img/edit.gif"></a> </td>
<td class="tda"><a href="#"><input name="" type="image" src="img/del.gif"></a> </td>
<?php } while ($empl= mysql_fetch_assoc($resultat)); ?>
</tr>
</table>
</body>
</html>
merci d'avance