Me gustaría saber porqué cuando ejecuto el index.html
y aprieto el botón no me funciona me da el siguiente error:
Esta página no funciona
La página localhost no puede procesar esta solicitud ahora. HTTP ERROR 500
Sería de gran ayuda que resolvieseis mi duda ya que soy novato en php y mysql. Os dejo el código. Ah, uso Phpmyadmin.
validar.php
<pre>
<?php
$link=mysql_connect("localhost","root","Ciemrcraol") or die ("<h2>No se encuentra el servidor</h2>");
$db=mysql_select_db("datos",$link) or die ("<h2>Error de conexión</h2>");
//Valores del formulario
$nombre=$_POST['nombre'];
$nick=$_POST['nick'];
$email=$_POST['correo'];
$passwd=$_POST['contraseña'];
//Obtener longitud de string
$req=(strlen($nombre)*strlen($nick)*strlen($email)*strlen($passwd)) or die ("No se han llenado todos los campos");
$contraseñaUsuario=md5($passwd);
mysql_query("INSERT INTO datos VALUES ('', $nombre, '$nick', '$email', '$contraseñaUsuario')",$link) or die ("<h2>Error de envio de datos</h2>");
echo "Guardado correctamente";
?>
</pre>
index.html
<!DOCTYPE html>
<html>
<head>
<title>Login</title>
<meta charset="utf-8">
</head>
<body>
<h1 style="margin-left: 35%;">Registro de usuarios</h1>
<form action="validar.php" method="POST">
<table style="margin-left: 40%">
<tr>
<td><p>Nombre Completo</p><input type="text" name="nombre" placeholder="Nombre"></td>
</tr>
<tr>
<td><p>Nickname</p><input type="text" name="nick" placeholder="nombre01"></td>
</tr>
<tr>
<td><p>Correo</p><input type="email" name="correo" placeholder="algo@algo.com"></td>
</tr>
<tr>
<td><p>Contraseña</p><input type="password" name="contraseña" placeholder="secreto"></td>
</tr>
</table>
<br>
<button style="margin-left: 40%;" type="submit">Registrar</button>
</form>
</body>
</html>