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
|
<?php
$erreur='';
//Pour récupérer les élément d'un formulaire avec la méthod "post", c'est avec $_POST.
// on teste si le formulaire a bien été soumis
if(isset($_POST['submit']))
{
if (!empty($_POST['nom']) && !empty($_POST['premon']) && !empty($_POST['departement']) && !empty($_POST['cause']) && !empty($_POST['datedebut'])
&& !empty($_POST['datefin']) && !empty($_POST['nbrejours'])&& !empty($_POST['type']))
{
$nom= htmlspecialchars(trim($_POST['nom']));
$premon= htmlspecialchars(trim($_POST['premon']));
$departement= htmlspecialchars(trim($_POST['departement']));
$cause= htmlspecialchars(trim($_POST['cause']));
$datedebut= htmlspecialchars(trim($_POST['datedebut']));
$datefin= htmlspecialchars(trim($_POST['datefin']));
$nbrejours= htmlspecialchars(trim($_POST['nbrejours']));
$type= $_POST['type'];
//connexion au BD
$connect= mysql_connect ('localhost', 'root', '')or die ('erreur de connection en mysql');
// selection de la BD
mysql_select_db ('GRH');
// si tout a été bien rempli, on insère le message dans notre table SQL
$req=mysql_query("INSERT INTO demandes(nom,premon,departement,cause,datedebut,datefin,nbrejours,type) VALUES('$nom','$premon','$departement','$cause','$datedebut','$datefin','$nbrejours','$type')") or die (mysql_error());
die('votre demande est envoyer');
//déconnexion de serveur mysql
mysql_close($connect);
} else $erreur="<b><font color='red'> il faut saisir tous les champs</font></b>";
}
?>
<html>
<head>
<title>Demandez</title>
<link rel="shortcut icon" href="css/images/favicon.ico" />
<link href="css/template_style.css" type="text/css" rel="stylesheet" />
</head>
<body>
<div id="templatemo_header_wrapper">
<div id="templatemo_header">
<div id="logo"><a href="index.html"></a></div>
<p id="intro_text">Suspendisse at justo in felis ultricies cursus. Quisque risus sed lacus pharetra sit amet pretium lacus aliquet. Sed commodo tellus dictum et lacinia sem.</p>
<a class="intro_bg_by" href="index.html" title="images" target="_blank"><img src="images/templatemo_background.png" alt="images" /></a> </div>
</div>
<div id="templatemo_main_wrapper">
<div id="templatemo_main">
<div id="content">
<div id="home" class="section">
<a href="index.html" class="home_btn">home</a>
<fieldset><legend align="center" ><font size="+1" color="#000000" face="Times New Roman, Times, serif">Demandez Une Autorisation d'absence Ou du Congé</font> </legend>
<center>
<!-- creation de la table-->
<table cellpadding="1">
<!--appel de code php -->
<p id="erreur"><?php if(isset($erreur)!='')
echo $erreur ;?></p>
<form name="form_demande" action="" method="post">
<div id="texts">
<tr>
<td>nom: </td><td><input type="text" name="nom"/></td>
</tr>
<tr>
<td>Prenom:</td> <td><input type="text" name="prenom" /></td>
</tr>
<tr>
<td>Departement: </td><td><input type="text" name="departement"/></td>
</tr>
<tr>
<td>Cause:</td> <td><textarea rows="6" cols="20" name="cause"></textarea></td>
</tr>
<tr>
<td>Date début:</td> <td><input type="text" name="datedebut" /></td>
</tr>
<tr>
<td>Date fin:</td> <td><input type="text" name="datefin" /></td>
</tr>
<tr>
<td>Nombre de jours:</td> <td><input type="text" name="nbrejours" /></td>
</tr>
<tr>
<td>Type:</td> <td> <select name="type"><option></option>
<option value=" congé"> Congé</option>
<option value="absence">absence</option>
</td>
</tr>
<tr> <td></td>
<tr> <td> </td>
</tr>
<tr>
<td> <center> <input type="submit" value="valider" name="submit" class="btn"/></center> </td><td> <center><input type="reset" name="annuler"
value="annuler"/> </center> </td>
</tr>
</div>
</form>
</table>
</fieldset>
</center>
</fieldset>
</div>
</div>
</div>
</div>
<div id="templatemo_footer_wrapper">
<div id="templatemo_footer">
<p><b>Copyright © 2013 | Conçu par Maamouri Syrine & Rekik Marwa</b></p>
</div>
</div>
</body>
</html> |
Partager