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
|
<form method="post" action="demande conge.php">
<label for="nom"><span class="Style5"><span class="Style9">Nom et Prénom : <span class="Style6">.</span></span><span class="Style6">...... ... </span></span></label>
<span class="Style6"> </span>
<select name="nom" id="nom">
<option value="" selected="selected"></option>
<?php
try
{
$bdd = new PDO('mysql:host=localhost;dbname=gestion_congés', 'root', '');
}
catch(Exception $e)
{
die('Erreur : '.$e->getMessage());
}
$reponse = $bdd->query('SELECT nom_prenom FROM agent ORDER BY nom_prenom');
while ($donnees = $reponse->fetch())
{
?>
<option value=" <?php echo $donnees['nom_prenom'];?>"> <?php echo $donnees['nom_prenom'];?> </option>
<?php
}
$reponse->closeCursor();
?>
</select>
<?php
if ((!empty($_POST['nom']))
{
$rep = $bdd->prepare('SELECT RELIQUAT_PRECEDENT FROM agent where NOM_PRENOM = ?') or die (print_r($bdd->errorInfo()));
$rep->execute(array($_POST['nom']));
while ($donnees = $rep->fetch())
{
echo $_POST['nom'];
echo $donnees['RELIQUAT_PRECEDENT'];
}
$rep->closecursor();
}
else
{
echo 'Veuillez choisir un nom SVP';
}
?> |