Tengo un problema con un formulario: envío las variables por post y lo único que guarda es el nombre de las casillas, y me arroja el error Undefined Index. No sé cómo resolver este problema, no tengo ni la menor idea.
Estos son los errores que me marca:
PHP Notice: Undefined index: Nombre in
PHP Notice: Undefined index: Apellido in
PHP Notice: Undefined index: Correo in
PHP Notice: Undefined index: Contraseña in
Este es mi código:
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'>
<title>Registro</title>
</head>
<meta charset='UTF-8'>
<body>
<p><header><h1>TecnoNeed Registro de Usuario</h1></header></p>
<form enctype="text/plain" method="POST" action="iniciosec.php">
Nombre:<input type="text" name="Nombre" minlength="" required=true><br></br>
Apellidos:<input type="text" name="Apellidos" minlength="" required=true><br></br>
Correo:<input type="email" name="correo" minlength="" required=true><br></br>
Contraseña:<input type="password" name="Contraseña" minlength="10" required=true><br></br>
<button name="button">Ingresar</button>
</form>
<a href="Pag_IP/index.html">segir sin registro</a>
</form>
</div>
</body>
</html>
Este es mi código PHP:
<?php
$conectar=@mysqli_connect('localhost','root','123456789');
if (!$conectar) {
echo "Error de conexion con el host";
}else{
$database='bd_tecnoneed';
$Base=mysqli_select_db($conectar, $database);
if (!$Base) {
echo "Base de datos no localizada";
}
}
if (isset($_POST['button'])) {
$Nombre=$_POST['Nombre'];
$Apellidos=$_POST['Apellidos'];
$Correo=$_POST['Correo'];
$Contraseña=$_POST['Contraseña'];
}
$sql="INSERT INTO registro VALUES('$Nombre','$Apellidos','$Correo','$Contraseña')";
$ejecutar=mysqli_query($conectar, $sql);
if (!$ejecutar) {
echo "Upps!!! algo salio mal error al enviar los datos";
}else{
echo "Tus datos fueron guardados con exito!!!<br><a href='index.html'>Volver<a>";
}
?>