Good morning everyone ..... I have a problem in which my form should send the records to my database, but what it does is keep my records completely empty, I leave my code and hope someone can help me, thanks. .
This is my form, here I assign the names that will be sent to my next page
<?php
include('conexion.php')
?>
<body>
<form action="guarda_usuario.php" method="post" enctype="text/plain">
<h1>CONTACTO</h1>
<input type="text" placeholder="Escribe tu nombre" name="nombre" id="" <br>
<input type="text" placeholder="Escribe tu apellido" name="apellido" id=""> <br>
<input type="email" placeholder="Escribe tu email" name="email" id="" > <br>
<textarea placeholder="Escriba su comentario" name="comentario"></textarea> <br>
<select style="width:200px" name="juego" >
<option value="0">Selección:</option>
<?php
$query = $mysqli -> query ("SELECT * FROM productos");
while ($valores = mysqli_fetch_array($query)) {
echo '<option value="'.$valores[id].'">'.$valores[producto].'</option>'; } ?>
</select> <br> <br>
<input type="submit" value="ENVIAR" name="" id="boton">
</form>
</body>
This is my page where I sent the records to my database, I have that if the variables are empty they are equal to "null" which I think is doing and I do not know why ...
<?php
include('conexion.php');
?>
<?php
if (isset($_POST['nombre'])) {
$nombre = $_POST['nombre'];
} else {
$nombre = "";
}
if (isset($_POST['apellido'])) {
$apellido = $_POST['apellido'];
} else {
$apellido = "";
}
if (isset($_POST['email'])) {
$email = $_POST['email'];
} else {
$email = "";
}
if (isset($_POST['producto'])) {
$producto = $_POST['producto'];
} else {
$producto = "";
}
if (isset($_POST['comentario'])) {
$comentario = $_POST['comentario'];
} else {
$comentario = "";
}
$query="INSERT INTO usuarios (nombre, apellido, email, producto, comentaro) VALUES ('$nombre','$apellido','$email','$producto', '$comentario' )";
$resultado=$mysqli->query($query);
?>