0

我想问你们是否无论如何我可以获得下拉列表的值并将其传递给另一个 php 文件而不使用该方式?方式是我的菜单中有来自数据库的选项这是我在下拉菜单上的代码

mysql_connect("localhost", "root" , "");
mysql_select_db("hotelgal");
$query3 = "SELECT suite_code from tblsuite WHERE suite_name = '".$suitename."'";
$result3 = mysql_query($query3);
$row3 = mysql_fetch_assoc($result3);
$suite = $row3['suite_code'];
mysql_connect("localhost", "root" , "");
mysql_select_db("hotelgal");
$queryroom = "SELECT * from tblroom WHERE room_accommodation = '" . $suite . "' AND status = 'AVAILABLE'";
    $resultroom = mysql_query($queryroom);
if ($resultroom && mysql_num_rows($resultroom) > 0)
{
echo '<form name = "room" method = "get" action = "reserveupdate.php">';
echo '<select name = "room" id = "rooms">';
while($rows = mysql_fetch_assoc($resultroom))
{
echo '<option>' . $rows['room_no'] . '</option>';
}
echo '</select></form>';
}

我对此没有问题,问题是我正在尝试选择下拉列表的文本并将其传递给另一个具有此代码的 php 文件

if (isset($_GET['room'])){
$query = "UPDATE tblreserve SET room_no = '" .$_GET['room']. "', status = 'APPROVED' WHERE reservation_code = '" . $reser . "'";
$res = mysql_query($query);
$query2 = "UPDATE tblroom SET status = 'OCCUPIED' WHERE room_no = '" . $_GET['room'] . "'";
$res2 = mysql_query($query2);
echo "<script>alert('Reservee Approved!'); window.location = './adminreserve.php';</script>";
}
4

0 回答 0