Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. <?php
  2. $db_host="localhost";
  3. $db_user="root";
  4. $db_password="123456";
  5. $db_name="Inscripcion";
  6. $db_table_name="Nuevo";
  7. $db_connection = mysqli_connect($db_host, $db_user, $db_password, $db_name);
  8.  
  9. if (!$db_connection) {
  10. die('No se ha podido conectar a la base de datos');
  11. }
  12. $subs_name = utf8_decode($_POST['nombre']);
  13. $subs_last = utf8_decode($_POST['apellido']);
  14. $subs_email = utf8_decode($_POST['email']);
  15.  
  16. $resultado = mysqli_query($db_connection, "SELECT * FROM Nuevo");
  17.  
  18. if (mysqli_num_rows($resultado)>0)
  19. {
  20.  
  21. header('Location: Fail.html');
  22.  
  23. } else {
  24.  
  25. $insert_value = "INSERT INTO Nuevo (Nombre, Apellido, email) values ('$_POSTname[nombre]','$_POST[apellido]','$_POST[email]')";
  26.  
  27. $retry_value = mysqli_query($db_connection, $insert_value);
  28.  
  29. if (!$retry_value) {
  30. //die('Error: '.mysqli_error());
  31. }
  32.  
  33. header('Location: success.html');
  34.  
  35. }
  36.  
  37. mysqli_close($db_connection);
  38.  
  39.  
  40. ?>
  41.  
  42. <!doctype html>
  43. <html>
  44. <head>
  45. <meta charset="utf-8">
  46. <title>Formulario de Registro SCIII</title>
  47. <link href="estilos.css" rel="stylesheet" type="text/css">
  48. </head>
  49.  
  50. <body>
  51.  
  52.  
  53.  
  54. <div class="group">
  55. <form action="registro.php" method="POST" action="registro.php">
  56. <h2><em>Formulario de Registro</em></h2>
  57.  
  58.  
  59. <label for="nombre">Nombre <span><em>(requerido)</em></span></label>
  60. <input type="text" id="nombre" name="nombre" class="form-input" required/>
  61.  
  62. <label for="apellido">Apellido <span><em>(requerido)</em></span></label>
  63. <input type="text" id="apellido" name="apellido" class="form-input" required/>
  64.  
  65. <label for="email">Email <span><em>(requerido)</em></span></label>
  66. <input type="email" id="email" name="email" class="form-input" />
  67.  
  68. <center> <input class="form-btn" name="submit" type="submit" value="Suscribirse" /></center>
  69. </form>
  70. </div>
  71. </body>
  72. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement