<?php
require "defaultincludes.inc";
require_once "mrbs_sql.inc";
require_once "config.inc.php";
$areas = $_POST["areas"];

// print the page header
print_header($day, $month, $year, $area, isset($room) ? $room : "");

echo "<div id=\"dwm_header\" class=\"screenonly\">\n";
?>
<form action="choose.php" method='post'>
  <div class="container">
    <h1>STEP 2 : Choose Room For Booking</h1>
    
    <hr>

    <label for="ROOM NAME"><b>ROOM NAME</b></label>
   
    
<?php


$conn = new mysqli($db_host, $db_login, $db_password, $db_database) 
or die ('Cannot connect to db');

    $result = $conn->query("select id,room_name from mrbs_room where area_id='$areas'");
    
    echo "<html>";
    echo "<body>";
    echo "<select name='rooms'>";

    while ($row = $result->fetch_assoc()) {

                  unset($id, $name);
                  $id = $row['id'];
                  $name = $row['room_name']; 
                  echo '<option value="'.$id.'">'.$name.'</option>';
                 
}

    echo "</select>";
    echo "</body>";
    echo "</html>";
?>
</BR>
   
    <input type="text" value = '<?php echo $areas;?>' name="areas" size='small' readonly hidden>

    <hr>

    <button type="submit" class="registerbtn">GO</button>
  </div>

  
</form>

