[insert_php]

$company_name = filter_input(INPUT_POST, ‘company_name’);
$first_name = filter_input(INPUT_POST,’first_name’);
$last_name = filter_input(INPUT_POST, ‘last_name’);
$job_title = filter_input(INPUT_POST, ‘job_title’);
$phone_number = filter_input(INPUT_POST, ‘phone_number’);
$email_address = filter_input(INPUT_POST, ’email_address’);
$city = filter_input(INPUT_POST, ‘city’);
$state = filter_input(INPUT_POST, ‘state’);

$dsn = ‘mysql:host=localhost;dbname=cbagdon_motorsafe’;
$username = ‘cbagdon_MSrepair’;
$password = ‘THURSfeb2!’;

try {
$db = new PDO($dsn, $username, $password);
echo ‘Thank you for your interest in our white paper series!’;
} catch (PDOException $e) {
$error_message = $e->getMessage();
echo “An error occured whole connecting to the database: $error_message

“;
}

$query = “INSERT INTO completed_forms (companyname, firstname, lastname, jobtitle, phonenumber, emailaddress, city, state)
VALUES(:company_name, :first_name, :last_name, :job_title, :phone_number, :email_address, :city, :state)”;

$statement = $db->prepare($query);
$statement->bindValue(‘:company_name’, $company_name);
$statement->bindValue(‘:first_name’, $first_name);
$statement->bindValue(‘:last_name’, $last_name);
$statement->bindValue(‘:job_title’, $job_title);
$statement->bindValue(‘:phone_number’, $phone_number);
$statement->bindValue(‘:email_address’, $email_address);
$statement->bindValue(‘:city’, $city);
$statement->bindValue(‘:state’, $state);
$statement->execute();
$statement->closeCursor();

[/insert_php]