add ticket processing functionality and enable employee login form

This commit is contained in:
vista-man
2025-04-09 10:06:19 +02:00
parent 2816c6eda5
commit 751ee3ad10
2 changed files with 37 additions and 2 deletions

View File

@@ -45,7 +45,7 @@
</div> </div>
</div> </div>
</nav> </nav>
<!--
<div class="container mt-5"> <div class="container mt-5">
<h1 class="text-center">Medewerker Login</h1> <h1 class="text-center">Medewerker Login</h1>
<form id="loginForm" action="process_login.php" method="POST" class="mt-4"> <form id="loginForm" action="process_login.php" method="POST" class="mt-4">
@@ -60,7 +60,6 @@
<button type="submit" class="btn btn-primary">Inloggen</button> <button type="submit" class="btn btn-primary">Inloggen</button>
</form> </form>
</div> </div>
-->
</body> </body>

36
process_ticket.php Normal file
View File

@@ -0,0 +1,36 @@
<!-- filepath: c:\xampp\htdocs\Spik-en-span\process_ticket.php -->
<?php
// Database connection
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "spik_en_span";
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->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();
?>