2
The page does not show any error, I already put the ini_set('display_errors', 1), but no errors appear, it loads, but it also does not redirect to my final page, it is only a blank page
<?php
if (!isset($_SERVER['HTTP_REFERER'])) { //CSRF
header('Location: index.php');
}
$servidor = '...';
$usuario = '...';
$senha = '...';
$banco = '...';
$conexao = mysqli_connect($servidor,$usuario,$senha,$banco);
if (mysqli_connect_errno())
{
echo "Erro ao conectar: " . mysqli_connect_error();
}
if (isset($_POST["submit"])) {
$email = htmlspecialchars($_POST['email']);
$endereco = htmlspecialchars(($_POST['endereco']));
$cep = htmlspecialchars(($_POST['cep']));
$estado = htmlspecialchars(($_POST['estado']));
$nome = htmlspecialchars(($_POST['nome']));
$sql = mysqli_query($conexao,"INSERT INTO dados (email, endereco, cep, estado, nome) VALUES ('$email', '$endereco','$cep','$estado','$nome')
");
header("Location: retorno.php");
}
?>
HTML code:
<form name="Form1" class="needs-validation" novalidate action="api.php" method="post">
<input type="hidden" name="total" id="total" value="20">
<div class="row">
<div class="col-md-6 mb-3">
<label for="firstName">Primeiro Nome</label>
<input type="text" class="form-control" name="firstName" id="firstName" placeholder="" value="" required>
<div class="invalid-feedback">
Insira um nome válido!
</div>
</div>
</div>
<div class="mb-3">
<label for="email">Email <span class="text-muted">(Opcional)</span></label>
<input type="email" class="form-control" name="email" id="email" placeholder="[email protected]">
<div class="invalid-feedback">
Insira um email válido!
</div>
</div>
<div class="mb-3">
<label for="address">Endereço</label>
<input type="text" class="form-control" name="address" id="address" placeholder="Rua Exemplo N1234" required>
<div class="invalid-feedback">
Insira um endereço válido!
</div>
</div>
<div class="row">
<div class="col-md-3 mb-3">
<label for="zip">CEP</label>
<input type="text" class="form-control" id="zip" id="zip" placeholder="" required>
<div class="invalid-feedback">
Insira um CEP Válido!
</div>
</div>
</div>
<hr class="mb-4">
<button class="btn btn-primary btn-lg btn-block" type="submit">Enviar</button>
</form>