PHP确认不起作用

时间:2016-03-31 11:06:26

标签: php

我正在为大学创建一个预订系统,我很难让我的代码正常工作,

SQL工作正常,但我找不到代码破解的原因并想要一些帮助

<?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>';

}
?>

有我的代码,任何帮助将不胜感激,我认为它与tid有关,但不完全确定

修改

    <?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>

我已经添加了更多代码,我需要帮助修复。这是显示所有预订的页面

我需要在哪里设置提交?

0 个答案:

没有答案