Ver Mensaje Individual
  #2 (permalink)  
Antiguo 06/10/2010, 07:01
Avatar de carmagedon
carmagedon
 
Fecha de Ingreso: junio-2005
Ubicación: Argentina
Mensajes: 794
Antigüedad: 18 años, 10 meses
Puntos: 23
Respuesta: Problema con formulario/BD.

Hola,

¿Donde está el problema? O sea, ¿que problema te aparece?

Código PHP:
Ver original
  1. <html>
  2. <head>
  3. </head>
  4. <body>
  5.  <?php
  6. function registrarse(){
  7.             $dbc=mysql_connect('hostname','usuario','pass');
  8.             mysql_select_db('nombre_bd');
  9.            
  10.             $email = $_POST["email"];
  11.             $nick = $_POST["nick"];
  12.             $pass = $_POST["pass"];
  13.  
  14.             $query= "insert into usuarios (ID_USER,EMAIL,NICK,PASS) values (null,'".$email."','".$name."','".$pass."')";
  15.            
  16.             if(@mysql_query($query)){
  17.                 echo '<p>Registrado correctamente</p>';
  18.                
  19.             }else{
  20.                 echo '<p style="color: red" >Error al registrar</p>';
  21.             }
  22.        
  23.             mysql_close();        
  24.  
  25. }
  26.  
  27. ?>
  28.  
  29. <form method="post" action="formulario.php">
  30. Inserta tus datos: <br>
  31. <table style= "border: 0">
  32. <td>Nombre</td>
  33. <td><input name="name" size="20" maxlength="30" id="name"></td><tr>
  34. <td>email</td>
  35. <td><input name="pass" size="30" maxlength="50" id="email"></td><tr>
  36. <td>pass</td>
  37. <td><input name="email" size="30" maxlength="50" id="pass"></td><tr>
  38. </table>
  39.  
  40. <p style="text-align: center"><input type="submit" onclick="registrarse()" value="aceptar"><input type="reset" value="Reiniciar formulario">
  41. </form>
  42.  
  43. </body>
  44.  
  45. </html>

Fijate si te funciona así,
Suerte.
__________________
Freelance - Aplicaciones Web