Guest User

Untitled

a guest
Jan 23rd, 2018
134
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. if(isset($_POST['logjob'])){
  3. $host = '';
  4. $user = '';
  5. $pass = '';
  6. $db = '';
  7.  
  8. $conn = new mysqli($host, $user, $pass, $db);
  9.  
  10. if ($conn->connect_error) {
  11. die("Connection failed: " . $conn->connect_error);
  12. }
  13.  
  14. $name = $conn->escape_string($_POST['name']);
  15. $email = $conn->escape_string($_POST['email']);
  16.  
  17. $sql = "INSERT INTO users (name, email) VALUES ('$name','$email')";
  18.  
  19. if ($conn->query($sql) === TRUE) {
  20. echo "<script type= 'text/javascript'>alert('New record created successfully - returning to home.');</script>";
  21.  
  22. }
  23. else {
  24. echo "<script type= 'text/javascript'>alert('Error: " . $sql . "<br>" . $conn->error."');</script>";
  25. }
  26. $conn->close();
  27. }
  28. ?>
Add Comment
Please, Sign In to add comment