<html>
 <head>
  <meta http-equiv="refresh" content="3;url=../index.html">
</head> 
<?php
// Kļūdu ziņošana
ini_set('display_errors', 1);
error_reporting(E_ALL);
$servername = "153.92.1.116";
$username = "admin";
$password = 'Te$t@dm1n';
$dbname = "my_website_db";

// Izveido savienojumu
$conn = new mysqli($servername, $username, $password, $dbname);

// Pārbauda savienojumu
if ($conn->connect_error) {
    die("Savienojuma kļūda: " . $conn->connect_error);
}

// Iegūst datus no formas
$name = $_POST['name'];
$surname = $_POST['surname'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$service = $_POST['service'];
$notes = $_POST['notes'];

// Saglabā datus datubāzē
$sql = "INSERT INTO pasutijumu_veiksana (name, surname, email, phone, service, notes)
VALUES ('$name', '$surname', '$email', '$phone', '$service', '$notes')";
//echo $sql;
if ($conn->query($sql) === TRUE) {
    echo "Pasūtījums veikts veiksmīgi!";
} else {
    echo "Kļūda: " . $sql . "<br>" . $conn->error;
}

// Aizver savienojumu
$conn->close();
?>
</html>