";
}
include("connexion.php");
if(isset($_POST['txtDate']) && isset($_POST['banc']) && isset($_POST['heure'])){
$date = $_POST['txtDate'];
$banc = $_POST['banc'];
$heure = $_POST['heure'];
echo "date = ".$date." // banc = ".$banc." // heure = ".$heure."
" ;
$explosion = explode('-',$date);
$annee = $explosion[0];
$mois = $explosion[1];
$jour = $explosion[2];
$date = $jour."/".$mois."/".$annee;
echo "New date = ".$date."
";
$heurefin = (int)$heure + 1;
if($heurefin==24){
$heurefin = 0;
}
if(strlen($heurefin)==1){
$heurefin = "0".$heurefin;
}
if(strlen($heure)==1){
$heure = "0".$heure;
}
$heure = $heure.":00";
$heurefin = $heurefin.":00";
echo "Heure = ".$heure."
";
echo "Heure de fin = ".$heurefin."
";
$requete = "INSERT INTO reservation VALUES($banc,'$date','$login','$heure','$heurefin')";
$exec_requete = mysqli_query($db,$requete);
echo "";
}elseif(isset($_GET['txtDate']) && isset($_GET['banc']) && isset($_GET['heure'])){
$date = $_GET['txtDate'];
$banc = $_GET['banc'];
$heure = $_GET['heure'];
$requete = "INSERT INTO reservation VALUES($banc,'$date','$login','$heure','$heurefin')";
$exec_requete = mysqli_query($db,$requete);
echo "";
}else{
//echo "L'ajout n'a pas fonctionné";
echo "";
}
mysqli_close($db);
?>