diff options
author | Mateja <mail@matejamaric.com> | 2020-10-02 19:36:16 +0200 |
---|---|---|
committer | Mateja <mail@matejamaric.com> | 2020-10-02 19:36:16 +0200 |
commit | 86613978c06546af098e96ed9b9496a3dd67ad62 (patch) | |
tree | a4f1fce8b99146bf9d1f2b267ed28c89a2beadd0 /handle-reservation.php | |
parent | 0d8992a2762d6a2b983d9aa1c2944d6cebef7371 (diff) | |
download | old-php-yota-86613978c06546af098e96ed9b9496a3dd67ad62.tar.gz old-php-yota-86613978c06546af098e96ed9b9496a3dd67ad62.zip |
Work on reservation...
Diffstat (limited to 'handle-reservation.php')
-rw-r--r-- | handle-reservation.php | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/handle-reservation.php b/handle-reservation.php new file mode 100644 index 0000000..3e24dd8 --- /dev/null +++ b/handle-reservation.php @@ -0,0 +1,44 @@ +<?php +if ($_SERVER["REQUEST_METHOD"] == "POST") { + // DB INFO + $user = "yota_requester"; + $password = "oon5iraeghaidoShi5sheefie2uuz3gu"; + $database = "yota_call_db"; + $table = "activities"; + + // SPECIAL CALL + $specialCall = $_POST["scall"]; + + // TIME + $fromTime = $_POST["sdate"] . $_POST["stime"] . ":00"; + $toTime = $_POST["edate"] . $_POST["etime"] . ":00"; + + // FREQUENCIES + $frequencies = $_POST["freqs"][0]; + for ($i = 0; $i < sizeof($_POST["freqs"]) - 1; $i++) { + $frequencies += ", " . $_POST["freqs"][$i]; + } + + // MODES + $modes = $_POST["modes"][0]; + for ($i = 0; $i < sizeof($_POST["modes"]) - 1; $i++) { + $modes += ", " . $_POST["modes"][$i]; + } + + // OPERATOR INFORMATION + $operatorCall = $_POST["ocall"] . "<br>"; + $operatorName = $_POST["oname"] . "<br>"; + $operatorEmail = $_POST["email"] . "<br>"; + $operatorPhone = $_POST["phone"] . "<br>"; + + try { + //$conn = new PDO("mysql:host=localhost;dbname=$database", $user, $password); + //$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + //$stmt = $conn->prepare("INSERT INTO $table (name, surname, age) VALUES (:name, :surname, :age)"); + //$stmt->bindParam(':name', $_POST['fname']); + //$stmt->execute(); + //echo "<p>Data inserted.</p>"; + } catch (PDOException $e) { + echo "<p>Error!: " . $e->getMessage() . "</p>"; + } +} |