This form has been removing gray hair for a few hours and I can not find the reason why it is not saved.
I have the following PHP code, which I use to save a form in the DB
<?php
session_start();
$conexion = mysqli("localhost","root","","cbtahd");
if(!isset($_SESSION["user"])){
if(!isset($_POST["guardarReporte"])){
$emisor = $_POST["emisor"];
$sucursal = $_POST["sucursal"];
$area = $_POST["area"];
$ip = $_POST["ip"];
$extension = $_POST["extension"];
$receptor = $_POST["receptor"];
$reporte = $_POST["reporte"];
$fechaemi = $_POST["fechaemi"];
$email = $_SESSION["user"];
$insertar = "INSERT INTO tblreportes (emisor,sucursal,area,ip,extension,receptor,reporte,fechaEmi,email) VALUES ('$emisor', '$sucursal','$area','$ip','$extension','$receptor','$reporte','$fechaemi','$email')";
mysqli_query($insertar);
}
}
?>
The html part is the following
<form method="post" action="registrar.php">
<h1><p class="text-center">Crear reporte</p></h1>
<br>
<div class="form-group">
<label for="emisor">Emisor</label>
<input type="text" name="emisor" id="emisor" class="form-control">
</div>
<div class="form-group">
<label for="sucursal">Sucursal</label>
<input type="text" name="sucursal" id="sucursal" class="form-control">
</div>
<div class="form-group">
<label for="area">Area</label>
<input type="text" name="area" id="area" class="form-control">
</div>
<div class="form-group">
<label for="ip">IP</label>
<input type="text" name="ip" id="ip" class="form-control">
</div>
<div class="form-group">
<label for="extension">Extension</label>
<input type="text" name="extension" id="extension" class="form-control">
</div>
<div class="form-group">
<label for="receptor">Receptor</label>
<input type="text" name="receptor" id="receptor" class="form-control">
</div>
<div class="form-group">
<label for="reporte">Reporte</label>
<textarea class="form-control" id="reporte" name="reporte" rows="10" cols="50"></textarea>
</div>
<div class="form-group">
<label for="fechaEmi">Fecha de emision</label>
<input type="text" name="fechaemi" id="fechaemi" class="form-control">
</div>
<div class="form-group">
<a href="logout.php">ffgfgfgdg</a>
<input type="button" name="guardarReporte" id="guardarReporte" value="Enviar Reporte" class="btn btn-info">
</div>
<span id="result"></span>
</form>
When I put the sentence in the Workbench it records the data correctly.