i am creating a booking system for university, and i am struggling to get my code working,
The SQL works, but i cannot find why the code is breaking and wanted some help
<?php
$title = 'Confirm The Booking';
require_once 'header.php';
if(isset($_POST['submit'])){
$confirmed = mysqli_real_escape_string($db_server, trim($_POST['Confirmed']));
$name = mysqli_real_escape_string($db_server, trim($_POST['name']));
$tid = mysqli_real_escape_string($db_server, trim($_POST['tid']));
if(!empty($tid)){
$query = "UPDATE room1booking
SET Confirmed = '1'
WHERE id = 'tid'";
mysqli_query($db_server, $query);
echo '<p>You have successfully booked the room for ' . $name . '.</p>';
}
} else {
echo '<p>There is a problem with the system.</p>';
}
?>
There is my code, any help would be greatly appreciated, i think it is something to do with tid, but not entirely sure
edit
<?php
$title = 'room Booking';
require_once 'header.php';
?>
<ul>
<?php
$query = "SELECT * FROM `room1booking` ORDER BY date & start & id";
if ($result = mysqli_query($db_server, $query)) {
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_array($result, MYSQLI_BOTH)) {
echo '<li>
' . $row['name'] . '
' . $row['date'] . '
' . $row['start'] . '
<button type="submit"><a href="confirmBooking.php?tid=' . $row['id'] . '">Confirm</a></button>
<button><a href="denyBooking.php?tid=' . $row['id'] . '">Deny</a></button>
</li>';
}
} else {
echo '<li>There are no results</li>';
}
mysqli_free_result($result);
}
mysqli_close($db_server);
?>
</ul>
I have added in more code in terms of what i need help fixing. This is the page that displays all bookings
Where do i need to set up submit?