Archivo de formulario:
Código HTML:
<h1>Registrate, es gratis.</h1> Llena los datos que se solicitan a continuación y espera a la aprobación de tu cuenta. <form name = "contacto" method= "post" action= "registro.php"> <p align = "left"> <strong>Nombre</strong> <br> <input name= "nombre" type= "text" value="" size= "50"> <br> <br> <strong>Apellidos</strong> <br> <input name= "apellidos" type= "text" size= "50"> <br> <br> <strong>Nombre de usuario</strong> (Sólo es para el login, nadie vera publicamente este dato) <img src="img/rubik.png" width="222" height="234" align="right" /><br> <input name= "usuario" type= "text" size= "50"> <br> <br> <strong>Contraseña</strong> <br> <input name= "cont" type= "password" size= "50"> <br> <br> <strong> Correo Electronico </strong> <br> <input name= "email" type= "text" size= "50"> <br> <br> <input type= "submit" name= "Submit" value= "Enviar"> <br> </form>
Código PHP:
<?php
$host = "127.0.0.1";
$user = "root";
$password = "";
$db= "registrados";
$enlace = mysql_connect ($host, $user, $password);
mysql_select_db($db, $enlace);
if(isset($_POST['nombre']) && !empty($_POST['nombre']) &&
isset($_POST['apellidos']) && !empty($_POST['apellidos'])&&
isset($_POST['usuario']) && !empty($_POST['usuario'])&&
isset($_POST['contraseña']) && !empty($_POST['contraseña'])&&
isset($_POST['email']) && !empty($_POST['email']))
mysql_query("INSERT INTO 'usuarios' (nombre,apellidos,usuario,cont,email)
VALUES ('{$_POST['nombre']}','{$_POST['apellidos']}','{$_POST['usuario']}','{$_POST['cont']}','{$_POST['email']}')",$enlace);
?>
![lloron](http://static.forosdelweb.com/fdwtheme/images/smilies/chillando.png)