Guest User

Untitled

a guest
Dec 12th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. <?php
  2. $servername = "localhost";
  3. $username = "root";
  4. $password = "";
  5. $dbname = "resolveaqui";
  6.  
  7. // Create connection
  8. $conn = new mysqli($servername, $username, $password, $dbname);
  9. // Check connection
  10. if ($conn->connect_error) {
  11. die("Connection failed: " . $conn->connect_error);
  12. }
  13.  
  14. $nome = $_POST['nome'];
  15. $cpf = $_POST['cpf'];
  16. $data_nascimento = $_POST['data_nascimento'];
  17. $cel = $_POST['telefone'];
  18. $sexo = $_POST['sexo'];
  19. $endereco = $_POST['endereco'];
  20. $email = $_POST['email'];
  21. $tipo_valor = $_POST['tipo_valor'];
  22. //$tipo_servico_h = $_POST['tipo_servico_h'];
  23. //$tipo_servico_f = $_POST['tipo_servico_f'];
  24. $valor = $_POST['media_valor'];
  25.  
  26.  
  27. $sql = "INSERT INTO clientes (nome,cpf,sexo,data_nascimento,endereco,cel,email,tipo_valor,valor) VALUES ('$nome','$cpf','$data_nascimento','$cel','$sexo','$endereco','$email','$tipo_valor','$valor')";
  28.  
  29. if ($conn->query($sql) === TRUE) {
  30.  
  31. echo "<script>alert('Enviado com Sucesso!);</script>";
  32. header('Location: index.php');
  33. } else {
  34. echo "Error: " . $sql . "<br>" . $conn->error;
  35. }
  36.  
  37. $conn->close();
  38. ?>
Add Comment
Please, Sign In to add comment