| Current Path : /home/x/b/o/xbodynamge/crosstraining/reservation/admin/ |
| Current File : /home/x/b/o/xbodynamge/crosstraining/reservation/admin/modif_client.php |
<?php
include_once('init.inc.php');
if ($_POST['id']=="new"){
$print_nom='';
$print_prenom='';
$print_email='';
$print_gsm='';
$print_adr='';
$print_cp='';
$print_ville='';
$print_nb_seance='';
}
else{
if (isset($_GET['error']))
$sql = "SELECT * from reservation".$DB_prefixtable."client where id=".$_GET['id'];
else
$sql = "SELECT * from reservation".$DB_prefixtable."client where id=".$_POST['id'];
if (!isset($_GET['id'])){
$req = mysqli_query($db, $sql) or die('Erreur SQL !'.mysqli_error());
$client = mysqli_fetch_assoc($req);
$print_nom=$client['nom'];
$print_prenom=$client['prenom'];
$print_email=$client['email'];
$print_gsm=$client['gsm'];
$print_adr=$client['adr'];
$print_cp=$client['cp'];
$print_webaccess=$client['webaccess'];
$print_ville=$client['ville'];
$print_nb_seance=$client['nb_seance'];
echo $print_validite_jour=date('d',strtotime($client['validite_seance']));
echo $print_validite_mois=date('m',strtotime($client['validite_seance']));
echo $print_validite_annee=date('Y',strtotime($client['validite_seance']));
}
}
?>
<html>
<body>
<table style="width:100%;border:1px solid black;border-collapse:collapse;">
<tr>
<?php include_once('menu.php');?>
<td style="border:1px solid black;">
<form action="action_client.php" method="POST">
<?php
if (isset($_GET['error'])) {
if (strpos($_GET['error'], '1') !== false) echo "<br><font color=\"red\">ERREUR : Le nom, le prénom et l'eamil sont obligatoire</font><br>";
if (strpos($_GET['error'], '2') !== false) echo "<br><font color=\"red\">ERREUR : L'email existe déjà pour un autre client</font><br>";
}
?>
<table style="width:100%;border:0px">
<tr>
<td style="width:90px;">
Nom (*)
</td>
<td>
<input type="text" name="nom" size="100" maxlength="200" value="<?php echo $print_nom;?>">
</td>
</tr>
<tr>
<td>
Prenom (*)
</td>
<td>
<input type="text" name="prenom" size="100" maxlength="200" value="<?php echo $print_prenom;?>">
</td>
</tr>
<tr>
<td>
Email (*)
</td>
<td>
<input type="text" name="email" size="100" maxlength="200" value="<?php echo $print_email;?>">
</td>
</tr>
<tr>
<td>
Acces web
</td>
<td>
<?php
if ($_POST['id']=="new"){
echo '<input type="checkbox" id="scales" name="webaccess" value="checked" checked>';
}
else{
if ($print_webaccess=="1") $wa="checked";
else $wa=" ";
echo '<input type="checkbox" id="scales" name="webaccess" value="checked" '.$wa.'>';
}
?>
</td>
</tr>
<tr>
<td>
Gsm
</td>
<td>
<input type="text" name="gsm" size="100" maxlength="200" value="<?php echo $print_gsm;?>">
</td>
</tr>
<tr>
<td>
Adresse
</td>
<td>
<input type="text" name="adr" size="100" maxlength="200" value="<?php echo $print_adr;?>">
</td>
</tr>
<tr>
<td>
CP
</td>
<td>
<input type="text" name="cp" size="10" maxlength="6" value="<?php echo $print_cp;?>">
</td>
</tr>
<tr>
<td>
Ville
</td>
<td>
<input type="text" name="ville" size="100" maxlength="200" value="<?php echo $print_ville;?>">
</td>
</tr>
<tr>
<td>
Nb Seance
</td>
<td>
<?php
if ($print_nb_seance=='')
echo '<input type="text" name="nb_seance" size="10" maxlength="2" value="0">';
else
echo '<input type="text" name="nb_seance" size="10" maxlength="2" value="'.$print_nb_seance.'">';
?>
</td>
</tr>
<tr>
<td>
Validite
</td>
<td>
<select name="date_validite_jour">
<?php
for ($ind=1;$ind<31;$ind++){
echo '<option value="'.$ind.'"'; if ($ind==$print_validite_jour) echo " selected"; echo'>'.$ind.'</option>';
}
?>
</select>
/
<select name="date_validite_mois">
<?php
for ($ind=1;$ind<=12;$ind++){
echo '<option value="'.$ind.'"'; if ($ind==$print_validite_mois) echo " selected"; echo'>'.$ind.'</option>';
}
?>
</select>
/
<select name="date_validite_annee">
<?php
for ($ind=2017;$ind<=2025;$ind++){
echo '<option value="'.$ind.'"'; if ($ind==$print_validite_annee) echo " selected"; echo'>'.$ind.'</option>';
}
?>
</select>
</td>
</tr>
</table>
<?php
if ($_POST['id']=="new" || isset($_GET['error'])){
echo '<input type="hidden" name="type" value="new">';
echo '<input type="submit" value="Creer client">';
echo "</form>";
}
else{
echo '<input type="hidden" name="type" value="modif">';
echo '<input type="hidden" name="id" value="'.$client['id'].'">';
echo '<input type="submit" value="Modifier client">';
echo "</form>";
echo '<form action="action_client.php" method="POST">';
echo '<input type="hidden" name="type" value="remove">';
echo '<input type="hidden" name="id" value="'.$client['id'].'">';
echo '<input type="submit" value="Supprimer client">';
echo "</form>";
}
?>
<form>
</form>
</body>
</html>