Because the form only worked once

0

Hello, I made a small form and it only worked once, I did not change the code after that and it does not work anymore what could it be?

<?php
error_reporting(-1);
ini_set('display_errors', 'On');

//Criar a conexao
$link = new mysqli ("localhost", "root", "", "peixaria");
if($link->connect_errno){
     echo"Nossas falhas local experiência ..";
     exit();
}

if($_SERVER['REQUEST_METHOD'] == 'POST') {
    $mesa = $_POST['mesa'];
    $nome = $_POST['nome'];
    $telefone = $_POST['telefone'];
        $sql="INSERT INTO nreserva(mesa,nome,telefone) VALUES('$mesa','$nome','$telefone')";
        $resultado_reserva = mysqli_query($link,$sql);
}
?>
<!DOCTYPE html>
     <html>
      <head>
      <meta charset="UTF-8">
          <meta name="viewport" content="width=device-width, initial-scale=1">
        <body>
        <title>Reserva</title>
    <h1>Peixaria</h1>
    <ul class="menu cf">
      <li><a href="secao.php">Início</a></li>
      <li><a href="pedidos.php">Pedidos</a></li>
      <li><a href="reserva.php">Reserva</a></li>
      <li><a href="relatorio.php">Relatório</a></li>
    </ul>
    <br>
    <main>
      <form method="post" action="reserva.php">
        <header>
          <h2>Reserva</h2>
        </header>
        <fieldset>
          <label>
            <span>Mesa:</span>
            <input type="text" name="mesa"value="">
          </label>
          <label>
            <span>Nome:</span>
            <input type="text" name="nome" value="">
          </label>
          <label>
            <span>Telefone:</span>
            <input type="tel" name="telefone"value="">
          </label>
        </fieldset>
        <br>
<button class="btn" type="submit">Fazer Reserva</button>   
      </form>
    </main>
</body>

    
asked by anonymous 18.01.2017 / 21:05

1 answer

0

You may have given mysql an error, because depending on how you created the table, the primary key was repeated. Try to take a look at the php log to see what error it gave.

    
18.01.2017 / 21:23