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 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
| <?php
include('config.php');
$erreur='';
if(isset($_POST['submit']))
{
if(!empty($_POST['nom']) && !empty($_POST['prenom']) && !empty($_POST['CIN']) && !empty($_POST['tel']) && !empty($_POST['etatcivil']) &&
!empty($_POST['dateN']) && !empty($_POST['sexe']) && !empty($_POST['situation']) && !empty($_POST['nbreenfants']) && !empty($_POST['adresse']) && !empty($_POST['ville']) && !empty($_POST['email']))
{
if(!is_int($_POST['CIN'])){
$erreur="Vérifier votre Numéro de CIN";
}
$nom=htmlspecialchars(trim($_POST['nom']));
$prenom=htmlspecialchars(trim($_POST['prenom']));
$CIN=htmlspecialchars(trim($_POST['CIN']));
$tel=htmlspecialchars(trim($_POST['tel']));
$etatcivil=htmlspecialchars(trim($_POST['etatcivil']));
$dateN=htmlspecialchars(trim($_POST['dateN']));
$sexe=$_POST['sexe'];
$situation=$_POST['situation'];
$nbreenfants=htmlspecialchars(trim($_POST['nbreenfants']));
$adresse=htmlspecialchars(trim($_POST['adresse']));
$ville=$_POST['ville'];
$email=htmlspecialchars(trim($_POST['email']));
// la requete d'exécution
$request=mysql_query("INSERT INTO employees(nom,prenom,CIN,tel,etatcivil,dateN,sexe,situation,nbreenfants,adresse,ville,email)
VALUES('$nom','$prenom','$CIN','$tel','$etatcivil','$dateN','$sexe','$situation','$nbreenfants','$adresse','$ville','$email')")
or die (mysql_error());
die('Votre profil est bien enregistré');
} else {$erreur="il faut remplir tous les champs";}
}
// affichage des données de table employees
$req="SELECT * FROM employees e, login l where l.id_login=e.id_employe and l.id_login='".$_SESSION['idf']."'" or die(mysql_error());
$res=mysql_query($req)or die(mysql_error());
$ligne=mysql_fetch_array($res) or die(mysql_error());
// la mise a jour des données ;
if(isset($_POST['submit']))
{
//récupération des valeurs des champs:
$nom=$_POST['nom'];
$prenom=$_POST['prenom'];
$CIN=$_POST['CIN'];
$tel=$_POST['tel'];
$etatcivil=$_POST['etatcivil'];
$dateN= $_POST['dateN'];
$sexe=$_POST['sexe'];
$situation=$_POST['situation'];
$nbreenfants=$_POST['nbreenfants'];
$adresse=$_POST['adresse'];
$ville=$_POST['ville'];
$email=$_POST['email'];
// creation de la requete de mise a jour des données
$mise=mysql_query("UPDATE employees m, login log SET nom='$nom',
prenom='$prenom',
CIN='$CIN',
tel='$tel',
etatcivil='$etatcivil',
dateN='$dateN',
sexe='$sexe',
situation='$situation',
nbreenfants='$nbreenfants',
adresse='$adresse',
ville='$ville',
email='$email'
where log.id_login=m.id_employe AND log.id_login='".$_SESSION['idf']."'")or die( 'Requête invalide : ' . mysql_error());
die("mise a jour des données réussi");
}
?>
<html>
<head>
<title>Profil</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>
<p id="erreur">
<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>
<!-- l'appel de code php -->
<p id="erreur"> <?php if(isset($erreur)!='') echo $erreur;?></p>
<br/>
<br/>
<center>
<fieldset><legend align="center" ><font size="+1" color="#000000" face="Times New Roman, Times, serif">Remplir / Modifier Votre PV</font> </legend>
<table cellpadding="1">
<form name="f1" method="post">
<div id="texts">
<td>nom: </td><td><input type="text" name="nom" value="<?php echo $ligne['nom']; ?>" /></td>
</tr>
<tr>
<td>Prenom:</td> <td><input type="text" name="prenom" value="<?php echo $ligne['prenom']; ?>" /></td>
</tr>
<tr>
<td>CIN:</td> <td><input type="text" name="CIN" maxlength="8" value="<?php echo $ligne['CIN']; ?>" /></td>
</tr>
<tr>
<td>N° tel:</td> <td><input type="text" name="tel" maxlength="8" value="<?php echo $ligne['tel']; ?>" /></td>
</tr>
<tr>
<td>Etat Civil:</td> <td><input type="text" name="etatcivil" value="<?php echo $ligne['etatcivil']; ?>" /></td>
</tr>
<tr>
<td>
date Naissance:</td> <td><input type="text" size="1"name="dateN" maxlength="2" value="j"/> <input type="text" size="1" maxlength="2" name="dateN" value="m" />
<input type="text" size="4" maxlength="4" name="dateN" value="a"/></td>
</tr>
<tr>
<td> sexe:</td> <td>homme
<input type="radio" name="sexe" value="homme" />
femme<input type="radio" name="sexe" value="femme" /> </td>
</tr>
<td>Situation:</td><td><select name="situation" >
<option value="<?php echo $ligne['situation']; ?>"> <?php echo $ligne['situation']; ?></option>
<option>marié</option>
<option>En couple</option>
<option>veuf</option>
<option>célibataire</option>
<option> divorcé</option>
<option>fiancé</option>
<option>séparé</option>
</select>
<tr>
<td>Nombre D'Enfants:</td> <td><input type="text" name="nbreenfants" value="<?php echo $ligne['nbreenfants']; ?>"/></td>
</tr>
<tr>
<tr>
<td> Adresse:</td> <td><textarea rows="5" cols="20" name="adresse"><?php echo $ligne['adresse']; ?></textarea></td>
</tr>
<tr>
<td>ville:</td><td><select name="ville">
<option value="<?php echo $ligne['ville']; ?>"><?php echo $ligne['ville']; ?></option>
<option>nabeul</option>
<option>sousse</option>
<option>tunisie</option>
<option>bizerte</option>
<option >jandouba</option>
<option >mounastir</option>
</select>
</td>
</tr>
<tr>
<td> E-mail:</td> <td><input type="text" name="email" onFocus="if(this.value=='exemples@gmail.com'){this.value=''}" onblur="if(this.value==''){ (this.value='exemples@gmail.com')}" alt="E-mail" value="<?php echo $ligne['email'];?>"/></b></td></div>
</tr> <td></td>
<tr>
</tr>
<tr><td></td>
</tr> <td></td>
<tr>
<td><center> <input type="submit" value="envoyer" name="submit" class="btn"/></center></td><td> <center><input type="reset" name="annuler" value="annuler"/></center></td>
</tr>
</form>
</table>
</fieldset>
</center>
</div>
</div>
</div>
</div>
<div id="templatemo_footer_wrapper">
</div>
</body>
</html> |
Partager