Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <head>
- <?php
- $db_host = 'localhost'; // Server Name
- $db_user = 'root'; // Username
- $db_pass = ''; // Password
- $db_name = 'contacts'; // Database Name
- $conn = mysqli_connect($db_host, $db_user, $db_pass, $db_name);
- if (!$conn) {
- die ('Failed to connect to MySQL: ' . mysqli_connect_error());
- }
- ?>
- </head>
- <body>
- <?php
- $Users_First_Name=filter_var($_POST['UsersFirstname']);
- $Users_Second_Name=filter_var($_POST['UsersSurname']);
- $Users_Gender=filter_var($_POST['gender']);
- $Forename=filter_var($_POST['firstname']);
- $Surname=filter_var($_POST['surname']);
- $Mobile=filter_var($_POST['phonenumber']);
- $Home_Phone=filter_var($_POST['homephonenumber']);
- $EMail=filter_var($_POST['email']);
- $address=filter_var($_POST['Home_Address']);
- $Group=filter_var($_POST['Groupe']);
- $query_string = "INSERT INTO contact
- (Users_First_Name, Users_Second_Name, Users_Gender, Forename,
- Surname, Mobile, Home_Phone, EMail, Home_Address, Groupe)
- VALUES
- ('". $Users_First_Name . "',
- '" . $Users_Second_Name . "',
- '" . $Users_Gender . "',
- '" . $Forename . "',
- '" . $Surname . "',
- '" . $Mobile . "',
- '" . $Home_Phone . "',
- '" . $EMail . "',
- '" . $address . "',
- '" . $Group . "',);";
- if(mysqli_query($conn, $query_string)){
- echo "Records inserted successfully.";
- } else{
- echo "ERROR: Could not able to execute $query_string. " . mysqli_error($conn);
- }
- if (!$query) {
- die ('SQL Error: ' . mysqli_error($conn));
- }
- ?>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement