<?php

require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include ('includes/function.php');

$maindb = 'hotels';

$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];
mysqli_select_db($conn, $zdb);
$city = $_REQUEST["city"];
$checkin = $_REQUEST["checkin"];
$checkout = $_REQUEST["checkout"];

$c_i = date("w", strtotime($checkin));
$c_o = date("w", strtotime($checkout));

$fricond = "";
if ($c_i == 5 || $c_o == 5) {
    $fricond = " and `fblock`!='1'";
}
$mhotl = mysqli_query($conn, "SELECT code, hotelnm FROM hotels where city='$city' $fricond order by hotelnm ") or die(mysqli_error($conn));
echo "<option value=''></option>";

while ($thotl = mysqli_fetch_array($mhotl)) {
    echo "<option value='$thotl[code]'>$thotl[hotelnm]</option>";
}
?>