I'm trying to send data to MySQL
from a restaurant reservation, but it only worked the first time and now when I try to send it will not go any further. What is the possible error in my script?
Connection File with MySQL
:
<?php
session_start();
$servidor = "localhost";
$usuario = "root";
$senha = "";
$dbname = "sistema";
//Criar a conexao
error_reporting(0);
$link = new mysqli ("localhost", "root", "", "sistema");
if($link->connect_errno){
echo"Nossas falhas local experiência ..";
exit();
}
?>
Query and Form:
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST') {
$mesa=$_POST['mesa'];
$nome=$_POST['nome'];
$telefone=$_POST['telefone'];
$data=$_POST['data'];
$hora=$_POST['hora'];
$sql="INSERT INTO reservar(mesa,nome,telefone,data,hora) VALUES('$mesa','$nome','$telefone','$data','$hora')";
$resultado_cadastro = mysqli_query($link,$sql);
}
?>
<form method="post" action="http://localhost/peixaria/inicio2.php?btn=entrega">
<div class="reservations">
<h1>Reservar:</h1>
<p>Mesa: </p>
<input type="text" name="mesa" class="form" required>
<p>Nome: </p>
<input type="text" name="nome" class="form" required>
<p>Telefone: </p>
<input type="text" name="telefone" class="form" required>
<p>Data: </p>
<input type="date" name="data" class="form" required placeholder="dd/mm/jjjj">
<p>Hora: </p>
<input type="time" name="hora" class="form" required placeholder="14:30">
<button type="submit" >enviar</button>
</div>
<div class="thankyou">
<i class="fa fa-check-square-o"></i>
</div>
<div id="dtBox"></div>
</form>