Advertisement
phirani

Registration PHP

Nov 6th, 2014
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. $name = $_POST['name'];
  5. $lname = $_POST['lname'];
  6. $uname = $_POST['uname'];
  7. $pass = $_POST['pass'];
  8. $pass1 = $_POST['pass1'];
  9. $email = $_POST['email'];
  10. $email1 = $_POST['email1'];
  11.  
  12. if (empty($name) || empty($lname) || empty($uname) ||
  13. empty($pass) || empty($pass1) || empty($email) ||
  14. empty($email1)) {
  15.  
  16. die("<br> Please fill out the form correctly<br />");
  17.  
  18. }
  19. echo("Thank you $name your registration form has been accepted and a confirmation email will be sent to $email1");
  20.  
  21. $servername = "localhost";
  22. $username = "root";
  23. $password = "";
  24. $dbname = "dbusers";
  25.  
  26. // Create connection
  27. $conn = new mysqli($servername, $username, $password, $dbname);
  28. // Check connection
  29. if ($conn->connect_error) {
  30. die("Connection failed: " . $conn->connect_error);
  31. }
  32.  
  33. $sql = "INSERT INTO dropbox (name, lname, uname, pass, pass1, email, email1)
  34. VALUES ('$name', '$lname','$uname','$pass','$pass1' ,'$email', '$email1')";
  35.  
  36. if ($conn->query($sql) === TRUE) {
  37. echo "New record created successfully";
  38. } else {
  39. echo "Error: " . $sql . "<br>" . $conn->error;
  40. }
  41.  
  42. $conn->close();
  43.  
  44.  
  45.  
  46.  
  47.  
  48. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement