Advertisement
Guest User

Untitled

a guest
Apr 12th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. <?php
  2.  
  3. $servername = "localhost";
  4. $username = "root";
  5. $password = "cornwall";
  6.  
  7. $con=mysqli_connect('localhost','root','cornwall','ibill');
  8. // This code creates a connec'tion to the MySQL database in PHPMyAdmin named 'ibill':
  9.  
  10. if (mysqli_connect_errno()) {
  11. echo "Failed to connect to MySQL: " . mysqli_connect_error();
  12. }
  13. // The connection is then checked, if it fails, an echo is sent back to the page stating a connection error.
  14.  
  15. $username = $_POST['username'];
  16. $firstname = $_POST['firstname'];
  17. $surname = $_POST['surname'];
  18. $emailaddress = $_POST['emailaddress'];
  19. $password = $_POST['password'];
  20. $confirmpassword = $_POST['confirmpassword'];
  21. //These are the different PHP variables that store my posted data.
  22.  
  23. $register="INSERT INTO user_details (username, firstname, surname, emailaddress, password,) VALUES ('$username', '$firstname', '$surname', '$emailaddress', '$password')";
  24. echo $register;
  25. $result=mysqli_query($con, $register);
  26. //This is the query that will be sent to the MySQL server.
  27.  
  28. header('Location: http://localhost/projects/ibill_v3/html/main.html#login');
  29. exit();
  30. //This directs the user to the relevant page after successful registration.
  31.  
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement