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
| <?php
include('config.php');
$erreur='';
//Pour récupérer les éléments d'un formulaire avec la méthod "post", c'est avec $_POST.
// on teste si le formulaire a bien été soumis(isset)
if(isset($_POST['submit']))
{
if (!empty($_POST['nom']) && !empty($_POST['prenom']) && !empty($_POST['departement']) && !empty($_POST['cause']) && !empty($_POST['datedebut'])
&& !empty($_POST['datefin']) && !empty($_POST['nbrejours'])&& !empty($_POST['type'])) // empty ++> pour tester si le champs vide ou pas
{
$nom= htmlspecialchars(trim($_POST['nom'])); //"trim pour mettre des espaces et "htmlspecialchars" pour la sécurisation sur le web
$prenom= htmlspecialchars(trim($_POST['prenom']));
$departement= htmlspecialchars(trim($_POST['departement']));
$cause= htmlspecialchars(trim($_POST['cause']));
$datedebut= $_POST['datedebut'];
$datefin= htmlspecialchars(trim($_POST['datefin']));
$nbrejours= htmlspecialchars(trim($_POST['nbrejours']));
$type= $_POST['type'];
// si tout a été bien rempli, on insère le message dans notre table SQL
$req=mysql_query("INSERT INTO demandes(nom,prenom,departement,cause,datedebut,datefin,nbrejours,type) VALUES('$nom','$prenom','$departement','$cause','$datedebut','$datefin','$nbrejours','$type')") or die (mysql_error());
echo"<b><font color='red'size='3'>votre demande est envoyer</font></b>";
} else $erreur="<b><font color='red'size='3'> 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_emp.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_emp.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">
<!-- close et home -->
<a href="index_emp.html" class="home_btn" alt="home">home</a>
<a href="logout.php" class="close" alt="close"> close </a>
<br/>
<br/>
<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>
<br/>
<br/>
<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" maxlength="4" size="4" /><input type="text" name="datedebut" maxlength="2" size="2"/><input type="text" name="datedebut" maxlength="2" size="2" /> </td>
</tr>
<tr>
<td>Date fin:</td> <td><input type="text" name="datefin" maxlength="4" size="4"/><input type="text" name="datefin" maxlength="2" size="2"/> <input type="text" name="datefin" maxlength="2" size="2"/>
</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>
<br/>
<br/>
</fieldset>
</center>
</fieldset>
</div>
</div>
</div>
</div>
<div id="templatemo_footer_wrapper">
</div>
</body>
</html> |
Partager