Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "cornwall";
- $con=mysqli_connect('localhost','root','cornwall','ibill');
- // This code creates a connec'tion to the MySQL database in PHPMyAdmin named 'ibill':
- if (mysqli_connect_errno()) {
- echo "Failed to connect to MySQL: " . mysqli_connect_error();
- }
- // The connection is then checked, if it fails, an echo is sent back to the page stating a connection error.
- $username = $_POST['username'];
- $firstname = $_POST['firstname'];
- $surname = $_POST['surname'];
- $emailaddress = $_POST['emailaddress'];
- $password = $_POST['password'];
- $confirmpassword = $_POST['confirmpassword'];
- //These are the different PHP variables that store my posted data.
- $register="INSERT INTO user_details (username, firstname, surname, emailaddress, password,) VALUES ('$username', '$firstname', '$surname', '$emailaddress', '$password')";
- echo $register;
- $result=mysqli_query($con, $register);
- //This is the query that will be sent to the MySQL server.
- header('Location: http://localhost/projects/ibill_v3/html/main.html#login');
- exit();
- //This directs the user to the relevant page after successful registration.
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement