aboutsummaryrefslogtreecommitdiff
path: root/handle-reservation.php
blob: 3e24dd8262b5b6d022f08a808fdc8e0cfba1ab94 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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>";
  }
}