Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/08/2009, 15:22
Avatar de PacoRuiz
PacoRuiz
 
Fecha de Ingreso: abril-2009
Mensajes: 254
Antigüedad: 15 años
Puntos: 3
Código para registrarse

Hola, estoy haciendo un código para que los usuarios se registren en una página. Creo que lo he hecho todo bien, incluso son partes de códigos que ya me han funcionado en otras ocasiones, sin embargo esto no me funciona y no veo el error por ningún lado. Por otro lado, no sé si es la mejor manera de hacerlo.

Son dos ficheros: formregistro.html y registro.php:

<html>
<form action="registro.php" method="post">
Usuario: <input type ="text" name ="dato[]"><br>
Contraseña: <input type= "text" name="dato[]"><br>
Nombre: <input type= "text" name="dato[]"><br>
Apellidos: <input type= "text" name="dato[]"><br>
Centro: <input type= "text" name="dato[]"><br>
Provincia: <input type= "text" name="dato[]"><br>
Población: <input type= "text" name="dato[]"><br>
Número de colegiado: <input type= "text" name=""dato[]"><br>
<input type ="submit" value ="LOG IN">
</form>
</html>

y registro.php

<?php
$link=mysql_connect("localhost","root","");
mysql_select_db(dbimagenes,$link);
$repetido=mysql_query("select count(*) from autores where nick=POST['usuario']");
if ($repetido){
echo "ya está en uso";
echo "<form action ='formregistro.html'><BR>";
echo"<input type='submit' value='ACEPTAR'><br>";
}
else{
$campo=$_post['dato'];
mysql_query("Insert autores
(nick,contraseña,nombre,apellidos,centro,provincia ,poblacion,colegiado)
VALUES
($campo[0],$campo[1],$campo[2],$campo[3],$campo[4],$campo[5],$campo[6]),$campo[7]");
echo "registrado corréctamente";
echo "$campo[0]";
echo "<form action ='opciones.php'><BR>";
echo"<input type='submit' value='ACEPTAR'><br>";
}
?>
</html>

Cuando me registro, me sale el mensaje de que me he registrado correctamente, pero la tabla autores sigue vacía.