Guest User

Untitled

a guest
Sep 1st, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Formulario De Contacto</title>
  5. <link rel="stylesheet" type="text/css" href="estilo.css">
  6. </head>
  7. <body>
  8. <div class="form">
  9. <form action="guardar.php" method="POST">
  10. <p>Nombre</p>
  11. <label for="nombre">Su nombre</label>
  12. <br>
  13. <input type="text" name="user" required>
  14. <p>Correo</p>
  15. <label for="correo">Direccion De Correo</label>
  16. <br>
  17. <input type="password" name="pass" required>
  18. <br>
  19. <br>
  20. <input type="submit" value="Enviar">
  21. </form>
  22. </div>
  23. </body>
  24. </html>
  25.  
  26. <?php
  27. //conectamos Con el servidor
  28. $conectar=@mysql_connect('localhost','Usuario','Contraseña');
  29. //verificamos la conexion
  30. if(!$conectar){
  31. echo"No Se Pudo Conectar Con El Servidor";
  32. }else{
  33.  
  34. $base=mysql_select_db('NombreBaseDeDatos');
  35. if(!$base){
  36. echo"No Se Encontro La Base De Datos";
  37. }
  38. }
  39. //recuperar las variables
  40. $user=$_POST['user'];
  41. $pass=$_POST['pass'];
  42. //hacemos la sentencia de sql
  43. $sql="INSERT INTO datos VALUES('$user',
  44. '$pass')";
  45. //ejecutamos la sentencia de sql
  46. $ejecutar=mysql_query($sql);
  47. //verificamos la ejecucion
  48. if(!$ejecutar){
  49. echo"Hubo Algun Error";
  50. }else{
  51. echo"Datos Guardados Correctamente<br><a href='index.html'>Volver</a>";
  52. }
  53. ?>
Add Comment
Please, Sign In to add comment