Advertisement
Guest User

Untitled

a guest
Apr 12th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. <?php
  2. //connect met de form als hij leeg is
  3. if ( ! empty($_POST)){
  4. $servername = "localhost";
  5. $username = "root";
  6. $password = "";
  7. $dbname = "auth";
  8. $naam = $_POST["naam"];
  9. $functie = $_POST["functie"];
  10. $tel = $_POST["tel"];
  11.  
  12. // Create connection
  13. $conn = new mysqli($servername, $username, $password, $dbname);
  14. // Check connection
  15. if ($conn->connect_error) {
  16. die("Connection failed: " . $conn->connect_error);
  17. }
  18.  
  19. $sql = "INSERT INTO users (naam, functie, tel)
  20. VALUES ('$naam', '$functie', '$tel')";
  21.  
  22. if ($conn->query($sql) === TRUE) {
  23. echo "New record created successfully";
  24. } else {
  25. echo "Error: " . $sql . "<br>" . $conn->error;
  26. }
  27.  
  28. $conn->close();
  29. }
  30. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement