无法将数据插入数据库(PHP)

时间:2019-12-15 15:32:35

标签: php sql database

这是purchasesite.php,它将直接指向updateseat.php

<input type="hidden" name="seatid" value="<?php foreach($_POST['seat'] as $seatid)echo $seatid ?>">

<input type="submit" name="checkoutbtn" value="Check Out Now">

这是我的updateseat.php代码

<?php
include "connection.php";
session_start();

if(isset($_POST["checkoutbtn"]))
        {
            $seatid = $_POST["seatid"];
            $reserveid = 1;

            $mysql = "INSERT INTO reservation_seat(Seat_ID, Reservation_ID) VALUES ('$seatid','$reserveid')";

            if(mysqli_query($connect,$mysql))
                echo "successfully";
            else
                echo "failed";
        }

?>

我在这里试图做的是插入从foreach变量中获取的数据,但是以某种方式不能将其保存到我的数据库中?有什么问题吗?

0 个答案:

没有答案