Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Includes.
- require_once("error_reporting.php"); //Initialize error reporting.
- include("../functions/dbconnection.php"); //Access database connection.
- //Get client's contact details from form.
- $firstName = $_POST['firstName'];
- $lastName = $_POST['lastName'];
- $address = $_POST['address'];
- $phoneNumber = $_POST['phoneNumber'];
- $emailAddress = $_POST['emailAddress'];
- //Get client's desired login details from form.
- $userName = $_POST['userName'];
- $password = $_POST['password'];
- //Insert user data into user table.
- $addClient="INSERT INTO client (firstName, lastName, address, phoneNumber, emailAddress)
- VALUES ('$firstName', '$lastName', '$address', '$phoneNumber', '$emailAddress')";
- if(@mysql_query($addClient))
- {
- //If client submits a user name.
- if(isset($userName))
- {
- //Get user ID (clientID(FK))
- $clientID=mysql_insert_id();
- //Insert the user details.
- $addUser="INSERT INTO users (userID, userName, password, clientID)
- VALUES (NULL, '$userName', '$password', $clientID)";
- $addResult=mysql_query($addUser);
- }
- //Display first name and user name - Used to check if client was added correctly.
- echo "Thank you ".$firstName." your user name is: ".$userName."<br>";
- echo("<p>Client Added.</p>");
- }
- else
- {
- echo("<p>Error adding client: </p>".mysql_error()."</p>");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement