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
| <?php
if (isset($_POST['Modifier']) && $_POST['Modifier'] == 'Modifier') {
{
$sql = 'UPDATE mabase.agent SET nom = "'.mysql_escape_string($_POST['nom']).'", prenom = "'.mysql_escape_string($_POST['prenom']).'", privilege = "'.mysql_escape_string($_POST['privilege']).'", email = "'.mysql_escape_string($_POST['email']).'", telephone = "'.mysql_escape_string($_POST['telephone']).'",
fonction_tech = "'.mysql_escape_string($_POST['fonction_tech']).'" WHERE id_agent="'.$_SESSION['id_agent'].'"';
mysql_query($sql) or die('Erreur SQL !'.$sql.'<br />'.mysql_error());
echo '<div class="succes">Modifications faites avec succès</br></div>';
}
}
else{
$erreur = 'Attention aux erreurs, remplissez correctement le formulaire pour modifier vos informations.';
}
?>
<div id="box_Modif_Agent">
<form action="" method="post" name="form1" id="form1">
<table width="320" border="0" class="left">
<?php
if (isset($erreur)) {
echo '<div id="info" class="worning">'.$erreur.'</div><!--error-->';
} ?>
<br/><br/>
<h4>Modifier compte</h4>
<tr>
<td class="td">Nom</td>
<td> <input type="text" name="nom" class="input_ajout_agent" value="<?php if (isset($_POST['nom'])) echo htmlentities(trim($_POST['nom'])); ?>" ></td>
</tr>
<tr>
<tr>
<td>Prenom</td>
<td >
<input type="text" name="prenom" class="input_ajout_agent" value="<?php if (isset($_POST['prenom'])) echo htmlentities(trim($_POST['prenom'])); ?>" ></td>
</tr>
<tr>
<td>Privilege</td>
<td>
<select name="privilege" class="input_ajout_agent" value="<?php if (isset($_POST['privilege'])) echo htmlentities(trim($_POST['privilege'])); ?>" >
<option>Administrateur</option>
<option>Utilisateur</option>
</select>
</td>
</tr>
<tr>
<td class="td">E-mail</td>
<td> <input type="text" name="email" class="input_ajout_agent" value="<?php if (isset($_POST['email'])) echo htmlentities(trim($_POST['email'])); ?>"></td>
<tr>
<td class="td">Téléphone</td>
<td> <input type="text" class="input_ajout_agent" name="telephone" value="<?php if (isset($_POST['telephone'])) echo htmlentities(trim($_POST['telephone'])); ?>"></td>
</tr>
<tr>
<td class="td">Fonction</td>
<td>
<select name="fonction_tech" class="input_ajout_agent" value="<?php if (isset($_POST['fonction_tech'])) echo htmlentities(trim($_POST['fonction_tech'])); ?>" >
<option>Managere</option>
<option>Sales</option>
<option>Technicien</option>
</select>
</td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="Modifier" class="submi" value="Modifier" /></td>
</tr>
</table>
</form></div>
</body>
</html> |
Partager