Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
178 changes: 0 additions & 178 deletions booking.html

This file was deleted.

96 changes: 70 additions & 26 deletions booking.php
Original file line number Diff line number Diff line change
@@ -1,34 +1,78 @@
<?php
include("connection.php");

// Check if the form was submitted using the POST method
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Retrieve the form data sent via POST
$user_date = $_POST['date']; // The date input from the form
$user_time = $_POST['time']; // The time input from the form
$user_text = $_POST['text']; // The text input from the form
// $user_location = $_POST['location_book']; // This line is commented out but could be used for location data
session_start();
include("connection.php");
$can_book = isset($_SESSION['Username']); // if it's true
if ($_SERVER["REQUEST_METHOD"] == "POST" && $can_book) {
$user_date = $_POST['date'];
$user_time = $_POST['time'];
$user_text = $_POST['text'];
$user_id = 12;
//$user_id = $_SESSION['UserID'];

// Format the date to match the MySQL date format (YYYY-MM-DD)
$formatted_date = date("Y-m-d", strtotime($user_date));

// Prepare the SQL query to insert the booking data into the "booking" table
$query = $conn->prepare("INSERT INTO booking (date, time, text) VALUES (?,?,?)");

// Bind the form values to the prepared statement
// The "sss" means all three parameters (date, time, and text) are strings
$query->bind_param("sss", $formatted_date, $user_time, $user_text);

// Execute the query and check if it was successful
$query = $conn->prepare("INSERT INTO Booking (UserID, DateOfShoot, TimeOfShoot, TypeOfShoot, Message) VALUES (?, ?, ?, 'Portrait', ?)"); // TODO fix user id session
$query->bind_param("isss", $user_id,$formatted_date, $user_time, $user_text);

if ($query->execute()) {
// If the query is successful, output a success message
echo "added date: " . $formatted_date . " successfully";
echo "<script>alert('booking successful.');</script>";
} else {
// If there's an error with the query execution, output the error message
echo "error: " . $query->error;
echo "<script>alert('Error: " . $query->error . "');</script>";

}
}
$query->close();

// Close the prepared query after execution to free up resources
$query->close();
}
include ("header.php");
?>
<!-- BOOKING FORM -->
<main class="booking_container">
<aside class="form">
<?php if ($can_book): ?>
<!-- while user login -->
<form action="booking.php" class="booking_form" method="POST">
<h1>Booking</h1>
<label for="">Prefered date</label>
<input type="date" id="date_book" name="date" required />
<hr />
<label for="">Prefered time</label>
<input type="time" id="time_book" name="time" required />
<hr />
<label for="location_book">Location</label>
<select name="location_book" id="location_book" required>
<option value="Dublin">Dublin</option>
<option value="Cork">Cork</option>
<option value="Limerick">Limerick</option>
</select>
<hr />
<fieldset class="photoshoot">
<legend>Type of a photoshoot</legend>
<div class="checkbox">
<label for="portrait">Portrait</label>
<input type="checkbox" name="portrait" id="portrait" value="portrait" />
<label for="family">Family</label>
<input type="checkbox" name="family" id="family" value="family" />
</div>
</fieldset>
<hr />
<label for="book_message">Your message</label>
<textarea name="text" id="book_message"></textarea>
<hr />
<p class="note">
Your preferred date and time may not fit into my timetable, so I
will be in contact with you to confirm your booking date and
time
</p>
<section class="button-area">
<button type="submit" class="button-area" name="submit">Finish booking</button>
</section>
</form>
<?php else: ?>
<!-- Giriş yapmamışsa uyarı ver -->
<h2 style="color: red;">please make sure you loged in!</h2>
<a href="login.php">login</a>
<?php endif; ?>
</aside>
</main>
<script src="./javascript/script.js"></script>
</body>
</html>
14 changes: 0 additions & 14 deletions connection.php

This file was deleted.

50 changes: 50 additions & 0 deletions footer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!-- FOOTER -->
<footer>
<div id="container"> <!-- div is for grid-->
<!-- Contact information of the photographer -->
<address class="contact">
<h3>Contact Me:</h3>
<p>+353 01 234 56 78</p>
<p>[email protected]</p>
</address>
<!-- Navigation menu copying the top navigation -->
<article class="pages">
<nav class="footer-menu">
<li class="footer-item">
<a href="about.html" class="footer-link">About Me</a>
</li>
<li class="footer-item">
<a href="service.html" class="footer-link">Service</a>
</li>
<li class="footer-item">
<a href="gallery.html" class="footer-link">Gallery</a>
</li>
<li class="footer-item">
<a href="login.html" class="footer-link">Log in </a>
</li>
</nav>
</article>
<!-- Social media links -->
<article class="footer-links">
<h3>Follow me:</h3>
<section class="social-media">
<a href="https://www.instagram.com/ivanatumbeva_photo/" target="_blank"><i
class="fa-brands fa-instagram"></i></a>
<a href="https://www.facebook.com/ivana.tumbeva" target="_blank"><i class="fa-brands fa-facebook"></i></a>
</section>
<!-- Book button -->
<a class="button_dark" href="booking.html">Book</a>
</article>
</div>
<!-- Authors of this website -->
<section class="madeby">® Group K (Elvira Negreeva, Ibrahim Cab Onder, Ibrahim Gurses), Griffith College, 2025</section>
</footer>

<!-- Script for handling top navigation menu animation-->
<script src="./javascript/script.js"></script>
<!-- SwiperJS Script for image carousel -->
<script src="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js"></script>
<script src="./javascript/swiper.js"></script>
</body>

</html>
Loading