From a3094caeb564821870870d57efb4a4fc3fd659e7 Mon Sep 17 00:00:00 2001
From: Mateja <mail@matejamaric.com>
Date: Sun, 4 Oct 2020 00:16:49 +0200
Subject: A whole lot of shaking going on...

---
 handle-reservation.php | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

(limited to 'handle-reservation.php')

diff --git a/handle-reservation.php b/handle-reservation.php
index c61ed3c..bed1949 100644
--- a/handle-reservation.php
+++ b/handle-reservation.php
@@ -59,7 +59,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
 
   // Error handling
   if ($is_something_empty) {
-    echo "<p class=\"mid\"><strong>All fields must be filed!</strong></p>";
+    $_SESSION["msg"] = "All fields must be filed!";
   }
   else {
     // Send to DB
@@ -79,9 +79,9 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
       $stmt->bindParam(':operatorEmail', $operatorEmail);
       $stmt->bindParam(':operatorPhone', $operatorPhone);
       $stmt->execute();
-      echo "<p class=\"mid\">Data inserted.</p>";
+      $_SESSION["msg"] = "Data inserted.";
     } catch (PDOException $e) {
-      echo "<p class=\"mid\">Error!: " . $e->getMessage() . "</p>";
+      $_SESSION["msg"] = "Error!: " . $e->getMessage();
     }
   }
 }
@@ -92,3 +92,5 @@ function clear_input($data) {
   $data = htmlspecialchars($data);
   return $data;
 }
+
+header("Location: reservation.php");
-- 
cgit v1.2.3