From 86613978c06546af098e96ed9b9496a3dd67ad62 Mon Sep 17 00:00:00 2001 From: Mateja Date: Fri, 2 Oct 2020 19:36:16 +0200 Subject: Work on reservation... --- handle-reservation.php | 44 ++++++++++++++++++++++++++++++++++++++++++++ index.php | 22 ++++++++++++++-------- notes.sql | 4 +++- reservation.php | 27 +++++++-------------------- style.css | 14 +++++++++++++- 5 files changed, 81 insertions(+), 30 deletions(-) create mode 100644 handle-reservation.php 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 @@ +"; + $operatorName = $_POST["oname"] . "
"; + $operatorEmail = $_POST["email"] . "
"; + $operatorPhone = $_POST["phone"] . "
"; + + 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 "

Data inserted.

"; + } catch (PDOException $e) { + echo "

Error!: " . $e->getMessage() . "

"; + } +} diff --git a/index.php b/index.php index 938534c..6fd938b 100644 --- a/index.php +++ b/index.php @@ -26,7 +26,7 @@ session_start();
'; echo "\n"; echo ""; - echo ""; - echo ""; - echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; echo "\n"; - foreach($db->query("SELECT * FROM $table where approved=true") as $row) { + foreach($db->query("SELECT * FROM $table where approved=false ORDER BY `id` DESC") as $row) { echo ""; - echo ""; - echo ""; - echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; echo "\n"; } diff --git a/notes.sql b/notes.sql index 1794c53..dd59770 100644 --- a/notes.sql +++ b/notes.sql @@ -3,15 +3,17 @@ USE yota_db; CREATE TABLE activities( `id` int(11) not null auto_increment primary key, + `approved` boolean not null default false; + `specialCall` varchar(50) not null, `fromTime` datetime not null, `toTime` datetime not null, - `specialCall` varchar(50) not null, `frequencies` varchar(255) not null, `modes` varchar(255) not null, `operatorCall` varchar(50) not null, `operatorName` varchar(50) not null, `operatorEmail` varchar(100) not null, `operatorPhone` varchar(50) not null + `qso` int not null default 0; ) charset=utf8; CREATE TABLE admins( diff --git a/reservation.php b/reservation.php index 7b34f71..ec46440 100644 --- a/reservation.php +++ b/reservation.php @@ -25,24 +25,7 @@ session_start();
setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $stmt = $conn->prepare("INSERT INTO activities (name, surname, age) VALUES (:name, :surname, :age)"); - $stmt->bindParam(':name', $_POST['fname']); - $stmt->bindParam(':surname', $_POST['lname']); - $stmt->bindParam(':age', $_POST['age']); - $stmt->execute(); - echo "

Data inserted.

"; - } catch (PDOException $e) { - echo "

Error!: " . $e->getMessage() . "

"; - } -} + require "handle-reservation.php"; ?>
@@ -52,11 +35,15 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['fname']) && isset($_PO + + - + + + - +
I will be active on bands: diff --git a/style.css b/style.css index 7fee13f..7b2b25e 100644 --- a/style.css +++ b/style.css @@ -48,7 +48,7 @@ nav a:hover { /* MAIN STYLING */ main { margin: 1rem auto; - max-width: 750px; + /*max-width: 750px;*/ line-height: 1.6rem; font-size: 1rem; @@ -71,6 +71,13 @@ table { width: 100%; } +thead { + background-color: black; + color: white; + /*color: black;*/ + /*background-color: #ccc;*/ +} + td, th { border: 1px solid #ccc; text-align: left; @@ -82,6 +89,11 @@ tr:nth-child(even) { } /* FORM STYLING */ +form { + max-width: 750px; + margin: 0rem auto; +} + input, select { width: 100%; padding: 12px 10px; -- cgit v1.2.3
ImePrezimeGodineOperatorFromToSpecial signFrequenciesQSO
" . $row['name'] . "" . $row['surname'] . "" . $row['age'] . "" . $row['operatorCall'] . "" . $row['fromTime'] . "" . $row['toTime'] . "" . $row['specialCall'] . "" . $row['frequencies'] . "" . $row['qso'] . "