Advertisement
Guest User

Untitled

a guest
Jan 24th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. <?php
  2.  
  3. require
  4. ("conexao.php");
  5.  
  6. ?>
  7.  
  8.  
  9. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  10. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  11. <html xmlns="http://www.w3.org/1999/xhtml">
  12.  
  13. <head>
  14. <meta http-equiv="Content-Type" content="text/html;meta-charset= charset=iso-8859-1" />
  15. <meta charset="utf8"/>
  16. <title>Cadastre-se</title>
  17. </head>
  18.  
  19. <body>
  20.  
  21. <form name="cadastro" method="post" action="cadastro/cadastro.php">
  22.  
  23. Nome:
  24. <br>
  25. <input name="nome" type="text" id="nome" /><br />
  26. <br>
  27. Sobrenome
  28. <br>
  29. <input name="sobrenome" type="text" id="sobrenome" /><br />
  30. <br>
  31. Email
  32. <br>
  33. <input name="email" type="text" id="email" /><br />
  34. <br>
  35. Nome de Usuário
  36. <br>
  37. <input name="usuario" type="text" id="usuario" /><br />
  38. <br>
  39. Senha
  40. <br>
  41. <input name="senha" type="password" id="senha" /><br />
  42.  
  43.  
  44. <br>
  45. <input type="submit" name="Send" value="cadastrar" /> <br />
  46.  
  47. </form>
  48.  
  49. </body>
  50. </html>
  51.  
  52. <?php
  53. //conexoes desponiveis para o mysqli
  54. $dbhost="localhost";
  55. $dbuser="root";
  56. $dbpass="";
  57. $dberror1="nao foi possivel si copnectar ao banco de dados";
  58. $dberror2="nao foi possivel encontrar a tabela de dados";
  59.  
  60.  
  61. $conn = mysqli_connect($dbhost,$dbuser,$dbpass) or die ($dberror1);
  62.  
  63.  
  64. $select_db = mysqli_select_db($conn,'cadastro')or die ($error2);
  65.  
  66. ?>
  67.  
  68. <?php
  69.  
  70. require("../conexao.php");
  71.  
  72. ?>
  73. <html>
  74. <head></head>
  75. <body>
  76.  
  77. <?php
  78. $nome=$_POST['nome'];
  79. $sobrenome=$_POST['sobrenome'];
  80. $email=$_POST['email'];
  81. $usuario=$_POST['usuario'];
  82. $senha=$_POST['senha'];
  83.  
  84.  
  85. $sql=@mysqli_query("INSERT INTO utilizadores(nome,sobrenome,email,usuario,senha)
  86. values ('$nome','$sobrenome','$email','$usuario','$senha')");
  87.  
  88. echo"cadastro efectuado com sucesso";
  89.  
  90.  
  91.  
  92. ?>
  93.  
  94. </body>
  95. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement