<?php

include('../../db_connect/db.php');


$site_id =$_POST['site'];
$gender =$_POST['gender'];
$student_id = $_POST['student_id'];

//echo $gender;

      echo'<center>
      <div class="col-md-12">
    <div class="col-md-6">
        <input type="hidden" value="'.$site_id.'" id="site">
        <input type="hidden" value="'.$student_id.'" id="student_id">
      <select class="form-control"  id="block" onkeypress="room_select()" style="lenght:100%" autofocus required placeholder="Username (Email Address:)">
      <option></option>';


            $q = "SELECT * FROM hostel_blocks WHERE campus_id='$site_id' AND gender='$gender' ";
            $r = mysqli_query($conn_1, $q) ;

            if(mysqli_num_rows($r) > 0)
            {//show table
              while($row = mysqli_fetch_array($r)){


                echo '<option value="'.$row['id'].'">'.$row['title'].'</option>';

            }

            }else {
              echo '<option>No block available</option>';
            }
      echo '</select></div>
      <div class="col-md-6"><button class="form-control btn btn-primary glyphicon glyphicon-ok back" onclick="room_select()" name="submit">
      Click Here to Select Room!
      </button></div>
      </div><br><br><br>
      </center>
      <div id="qq"></div>';


?>
