-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathretrieve_data.php
More file actions
39 lines (38 loc) · 1.53 KB
/
retrieve_data.php
File metadata and controls
39 lines (38 loc) · 1.53 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
<?php
$conn = mysqli_connect('localhost', 'root', '', 'db_webuild');
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "SELECT * FROM Submit";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
echo"<h1 class='tt'>BOOKING DETAILS</h1>";
echo "<table>";
echo "<tr><th>Name</th><th>Email</th><th>Number</th><th>Location</th><th>Message</th><th>Services</th><th>Action</th></tr>";
while ($row = mysqli_fetch_assoc($result)) {
echo "<tr>";
echo "<td>" . $row["name"] . "</td>";
echo "<td>" . $row["email"] . "</td>";
echo "<td>" . $row["number"] . "</td>";
echo "<td>" . $row["location"] . "</td>";
echo "<td>" . $row["message"] . "</td>";
echo "<td>" . $row["services"] . "</td>";
// Add buttons for delete and print report
echo "<td>";
echo "<form method='post' action='delete.php'>";
echo "<input type='hidden' name='id' value='" . $row["id"] . "'>";
echo "<button type='submit' class='btn del' name='delete' onclick=\"return confirm('Are you sure you want to delete this row?')\">Delete</button>";
echo "</form>";
echo "<form method='post' action='print_report.php'>";
echo "<input type='hidden' name='id' value='" . $row["id"] . "'>";
echo "<button type='submit' class='btn' name='print'>Print Report</button>";
echo "</form>";
echo "</td>";
echo "</tr>";
}
echo "</table>";
} else {
echo "No data found.";
}
mysqli_close($conn);
?>