-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrate_event.php
More file actions
82 lines (70 loc) · 2.66 KB
/
Copy pathrate_event.php
File metadata and controls
82 lines (70 loc) · 2.66 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
session_start();
include 'config/db.php';
// Check if user is logged in
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit();
}
$user_id = $_SESSION['user_id'];
$event_id = $_GET['id'];
// Check if the form was submitted
if (isset($_POST['submit_review'])) {
$rating = $_POST['rating'];
$comment = $_POST['comment'];
// Insert the review
$stmt = $conn->prepare("INSERT INTO reviews (user_id, event_id, rating, comment) VALUES (?, ?, ?, ?)");
if ($stmt->execute([$user_id, $event_id, $rating, $comment])) {
echo "<script>alert('Thank you for your review!'); window.location.href='my_bookings.php';</script>";
} else {
echo "Error: Unable to submit review";
}
}
// Get Event Name for display
$event_stmt = $conn->prepare("SELECT title FROM events WHERE id = ?");
$event_stmt->execute([$event_id]);
$event = $event_stmt->fetch(PDO::FETCH_ASSOC);
?>
<?php
// Add these lines to see errors
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
// ... rest of your code ...
?><!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="assets/css/style.css">
<title>Rate Event</title>
<style>
body { font-family: sans-serif; background-color: #111827; color: #F9FAFB; padding: 20px; }
h2 { color: #F9FAFB; }
form { background: #1F2937; padding: 20px; border-radius: 8px; max-width: 400px; margin: 0 auto; }
label { color: #F9FAFB; display: block; margin-top: 10px; }
select, textarea { display: block; margin: 5px 0 15px; padding: 8px; width: 100%; background: #111827; color: #F9FAFB; border: 1px solid #9CA3AF; }
button { background: #8B5CF6; color: #F9FAFB; border: none; padding: 10px; width: 100%; cursor: pointer; }
button:hover { background: #00E5FF; }
a { color: #00E5FF; }
</style>
</head>
<body>
<h2>Rate Event: <?php echo $event['title']; ?></h2>
<form method="POST">
<label>Rate this seminar (1 to 5 Stars):</label><br>
<select name="rating" required>
<option value="5">⭐⭐⭐⭐⭐ (Excellent)</option>
<option value="4">⭐⭐⭐⭐ (Good)</option>
<option value="3">⭐⭐⭐ (Average)</option>
<option value="2">⭐⭐ (Poor)</option>
<option value="1">⭐ (Terrible)</option>
</select>
<br><br>
<label>Your Review:</label><br>
<textarea name="comment" rows="4" placeholder="What did you learn?"></textarea>
<br><br>
<button type="submit" name="submit_review">Submit Review</button>
</form>
<br>
<a href="my_bookings.php">Cancel</a>
</body>
</html>