Guest User

Untitled

a guest
Jun 30th, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Cadastro de Clientes</title>
  5. <meta charset="utf-8">
  6. <link rel="stylesheet" href="bootstrap/css/bootstrap.css">
  7. <link rel="stylesheet" href="bootstrap/css/style.css">
  8. <script src="bootstrap/js/bootstrap.js"></script>
  9. </head>
  10. <body>
  11. <div align="center" class="banner">
  12. <img src="img/Banner Giga.jpg">
  13. <form method="post" action="processa.php">
  14. <h1>Cadastro de Clientes</h1>
  15. <label>Nome:</label> <input type="text" class="campo" name="nome" required placeholder="Digite seu Nome:" maxlength="100"/><br><br>
  16. <label>Telefone:</label> <input type="text" class="campo" name="telefone" placeholder="Digite seu Telefone" maxlength="14"/><br><br>
  17. <label>Bairro:</label> <input type="text" class="campo" name="bairro" placeholder="Digite o seu Bairro" maxlength="100"/><br><br>
  18. <label>Rua:</label> <input type="text" class="campo" name="rua" placeholder="Digite sua Rua" maxlength="100"/><br><br>
  19. <label>Numero:</label> <input type="text" class="campo" name="numero_casa" placeholder="Numero da Casa" maxlength="100"/><br><br>
  20. <input type="submit" name="submit" value="Salvar" class="btn btn-danger">
  21. <input type="reset" value="Limpar" class="btn btn-danger">
  22. </form>
  23. </body>
  24. </html>
  25.  
  26. <?php
  27. $hostname= "localhost";
  28. $user = "root";
  29. $password = "";
  30. $database = "gigabyte";
  31. $conexao = mysqli_connect($hostname,$user,$password,$database);
  32. mysqli_select_db($conexao,$database);
  33. if(!$conexao){
  34. echo "Falha na conexão com o Banco de Dados";
  35.  
  36. }
  37. ?>
  38.  
  39. <?php
  40. include_once("conexao.php");
  41. $nome = filter_input(INPUT_POST,'nome');
  42. echo "Nome: $nome <br>";
  43. $telefone =filter_input(INPUT_POST,'telefone');
  44. echo "Telefone: $telefone<br>";
  45. $bairro =filter_input(INPUT_POST,'bairro' );
  46. echo "Bairro: $bairro<br>";
  47. $rua =filter_input(INPUT_POST,'rua' );
  48. echo "Rua: $rua<br>";
  49. $numero =filter_input(INPUT_POST,'numero_casa');
  50. echo "Numero: $numero<br>";
  51. $result="INSERT INTO clientes (nome,telefone,bairro,rua,numero_casa) VALUES('',$nome', '$telefone', '$bairro', '$rua', '$numero'))";
  52. $resultado= mysqli_query($conexao, $result);
  53. if($result == true){
  54. echo "Cadastrado com Sucesso!";
  55. }else{
  56. echo "Opa, Algo de errado não está certo";
  57. }
  58.  
  59.  
  60. ?>
Add Comment
Please, Sign In to add comment