-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcall_waiter.php
More file actions
28 lines (25 loc) · 1.07 KB
/
Copy pathcall_waiter.php
File metadata and controls
28 lines (25 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
session_start();
include 'includes/db_connect.php';
// Get table ID from session
$table_id = isset($_SESSION['table_id']) ? (int)$_SESSION['table_id'] : 1;
// Insert service request into database
$sql = "INSERT INTO service_requests (table_id, request_type, status) VALUES ($table_id, 'Waiter Assistance', 'Pending')";
$result = $conn->query($sql);
if ($result) {
// Return success response (can be JSON for AJAX)
if (!empty($_GET['ajax'])) {
header('Content-Type: application/json');
echo json_encode(['success' => true, 'message' => 'Staff notified! They will be at your table shortly.']);
} else {
echo "<script>alert('✓ Staff notified! They will be at your table shortly.'); window.location.href='menu.php';</script>";
}
} else {
if (!empty($_GET['ajax'])) {
header('Content-Type: application/json');
echo json_encode(['success' => false, 'message' => 'Error notifying staff']);
} else {
echo "<script>alert('❌ Unable to notify staff. Please try again.'); window.location.href='menu.php';</script>";
}
}
?>