I have the reservation code made, but the SELECT is so that people can not book the room on the same day I can not do. In my database I have the reservation table, in which the data is found.
backup_name, name, email, n_telef, checkin, checkout, nr_adults, room_type, precoT
Here is the code:
<?php
$link = mysqli_connect("localhost","root","","hotel");
$nome=$_POST['Nome'];
$email=$_POST['email'];
$telefone=$_POST['telefone'];
$checkin=$_POST['checkin'];
$checkout=$_POST['checkout'];
$nr_adultos=$_POST['nr_adultos'];
//$n_noites=$_POST['n_noites'];
$tipo_quarto=$_POST['tipo_quarto'];
$precoT=$_POST['pre'];
// verificacao de dados e feito em javascript e/ou html php so para comunicacao com servidor;
$query = "INSERT INTO reserva VALUES (NULL, '$nome', '$email', $telefone, '$checkin', '$checkout', $nr_adultos,'$tipo_quarto',$precoT)";
$result = mysqli_query ($link , $query);
if($result){
echo "<script> myFunction('Reserva feita'); </script>";
}else{
echo "<script> myFunction('Erro ao fazer a reserva'); </script>";
}
?>