From 751ee3ad10fdc2b2cf1a2f8f2b6d92403cc79010 Mon Sep 17 00:00:00 2001 From: vista-man <524715@vistacollege.nl> Date: Wed, 9 Apr 2025 10:06:19 +0200 Subject: [PATCH] add ticket processing functionality and enable employee login form --- employee-login.html | 3 +-- process_ticket.php | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 process_ticket.php diff --git a/employee-login.html b/employee-login.html index bd7903e..73da495 100644 --- a/employee-login.html +++ b/employee-login.html @@ -45,7 +45,7 @@ - diff --git a/process_ticket.php b/process_ticket.php new file mode 100644 index 0000000..cf77030 --- /dev/null +++ b/process_ticket.php @@ -0,0 +1,36 @@ + +connect_error) { + die("Connection failed: " . $conn->connect_error); +} + +// Retrieve form data +$name = $_POST['name']; +$email = $_POST['email']; +$category = $_POST['category']; +$quantity = $_POST['quantity']; +$ticket_id = "TICKET-" . time(); + +// Insert ticket into database +$sql = "INSERT INTO tickets (ticket_id, name, email, category, quantity) VALUES (?, ?, ?, ?, ?)"; +$stmt = $conn->prepare($sql); +$stmt->bind_param("ssssi", $ticket_id, $name, $email, $category, $quantity); + +if ($stmt->execute()) { + echo "Ticket successfully purchased! Your Ticket ID is: " . $ticket_id; +} else { + echo "Error: " . $stmt->error; +} + +$stmt->close(); +$conn->close(); +?> \ No newline at end of file