0
I have a normal form with a normal page to import the information to a normal bank table, but for some reason it falls straight into the die and does not save the information.
Form:
<form method="POST" action="update-cli.php">
<div class="container">
<div class="row">
<div class="col-lg-8 col-md-10 mx-auto">
<div class="form-group">
<label for="NOME">Nome:</label>
<input type="text" class="form-control" id="NOME" name="NOME" placeholder="Nome do cliente">
</div>
<div class="form-group">
<label for="DATA">Data de nascimento:</label>
<input type="text" class="form-control" id="DATA" name="DATA" placeholder="Data de Nascimento do cliente">
</div>
<div class="form-group">
<label for="ENDERECO">Endereço:</label>
<input type="text" class="form-control" id="ENDERECO" name="ENDERECO" placeholder="Endereço do consultório">
</div>
<div class="form-group">
<label for="TELEFONE">Telefone:</label>
<input type="text" class="form-control" id="TELEFONE" name="TELEFONE" placeholder="Telefone fixo">
</div>
<div class="form-group">
<label for="CELULAR">Celular:</label>
<input type="text" class="form-control" id="CELULAR" name="CELULAR" placeholder="Telefone celular">
</div>
<button type="submit" class="btn btn-primary btn-lg btn-block">Salvar</button>
</div>
</div>
</div>
</form>
Import page:
<?php
$nome = $_POST['NOME'];
$data = $_POST['DATA'];
$endereco = $_POST['ENDERECO'];
$telefone = $_POST['TELEFONE'];
$celular = $_POST['CELULAR'];
$strcon = mysqli_connect('localhost','root','', 'sis_tam') or die('Erro ao conectar ao banco de dados');
$sql = "INSERT INTO clientes VALUES ('$nome', '$data', '$endereco', '$telefone', '$celular')";
mysqli_query($strcon,$sql) or die("Erro ao tentar cadastrar registro");
mysqli_close($strcon);
echo '<script type="text/javascript">
alert("Salvo com Sucesso !");
window.history.go(-1);
</script>';
?>
Table in the bank:
ID NAME DATE ADDRESS CELL PHONE
Can anyone point out the problem? Thank you
What error is being shown?
– Yure Pereira
Database connection data is correct?
– Yure Pereira
How is the sql structure of the table in the database?
– Yure Pereira
The error that gives is "Error trying to register", the one I put in "or die".
– Mariana Bayonetta