connection.php
try {
$server = "localhost";
$username = "root";
$password = "";
$connection = new PDO("mysql:host=$server; dbname=database_name", $username, $password);
$connection -> setATTRIBUTE(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(Exception $e) {
echo "error!: " . $e -> getMessage();
die();
}
?>
db.php
include('./connection.php');

if(isset($_POST['submit'])) {
$users_name = $_POST['name'];
$users_email= $_POST['email'];
$users_message = $_POST['message'];

header('./index.php');
$query = "INSERT INTO users (users_name, users_email, users_messsage) VALUES (:users_name, :users_email, :users_mesage)";
$query_run = $connection -> prepare($query);
$data = [':users_name' => $users_name, ':users_email' => $users_email, ':users_message' => $users_message];
$query_execute = $query_run -> execute($data);
}
HTML Form
< form class="form-horizontal" role="form" action="" method="POST" >

< div class="form-group row">
< label for="name" class="col-2 col-form-label">Name </label >
< input type="text" class="form-control" type="text" id="name" name="name"placeholder="Enter your name..." >
< /div >

<div class="form-group row" >
<label for="email" class="col-2 col-form-label">eMail </label >
<input type="email" class="form-control" type="text" id="email" name="email"placeholder="Enter your email..." >
< /div >

<div class="form-group row">
<label for="message" class="col-2 col-form-label>Message</label>
<textarea class="form-control" row="4" id="message" name="message"></textarea>
</div>
< div class="form-group row">
<button name="submit" class="btn btn-web">SendMesage</button>
</div>
</form>