Advertisement
quraisah92

welcome.php

Oct 26th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.77 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <title>result</title>
  5. </head>
  6. <body>
  7.  
  8. <?php
  9. if(isset($_POST["submit"])){
  10. $servername = "localhost";
  11. $username = "root";
  12. $password = "";
  13. $dbname = "contactest";
  14.  
  15. // Create connection
  16. $conn = new mysqli($servername, $username, $password, $dbname);
  17. // Check connection
  18. if ($conn->connect_error) {
  19. die("Connection failed: " . $conn->connect_error);
  20. }
  21.  
  22. $sql = "INSERT INTO ter (names,email)
  23. VALUES ('".$_POST["names"]."','".$_POST["Email"]."')";
  24.  
  25. if ($conn->query($sql) === TRUE) {
  26. echo "<script type= 'text/javascript'>alert('New record created successfully');</script>";
  27. } else {
  28. echo "<script type= 'text/javascript'>alert('Error: " . $sql . "<br>" . $conn->error."');</script>";
  29. }
  30.  
  31. $conn->close();
  32. }
  33. ?>
  34.    
  35. </body>
  36. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement