Advertisement
Guest User

Untitled

a guest
Aug 10th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. <?php
  2. $servername = "localhost";
  3. $dbusername = "root";
  4. $dbpassword = "";
  5. $dbname = "signup";
  6.  
  7. $fname = $_POST['fname'];
  8. $lname = $_POST['lname'];
  9. $email = $_POST['email];
  10.  
  11. $conn = new mysqli($servername, $dbusername, $dbpassword, $dbname);
  12.  
  13. if ($conn->connect_error) {
  14. die("Connection failed: " . $connect_error);
  15. }
  16.  
  17. if(empty($fname)){
  18. echo "first name can not be blank. Please press back and put a name";
  19. die();
  20. }
  21.  
  22. if(empty($lname)){
  23. echo "last name can not be blank. Please press back and put a name";
  24. die();
  25. }
  26.  
  27. if(empty($email)){
  28. echo "email name can not be blank. Please press back and put a email";
  29. die();
  30. }
  31.  
  32. $sql= "INSERT INTO signupform (First_Name ,Last_Name ,Email)
  33.  
  34. VALUES('$fname','$lname','$email')"; this is the line 33
  35.  
  36. if ($conn->query($sql) == TRUE){
  37. echo"Thank you ! your info has been entered into our database you may close the window now.";
  38. }
  39. else{
  40. echo"Error: " .sql ."<br" . $conn->error;
  41.  
  42. $conn->error();
  43.  
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement