<?php

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


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


echo'

<div class="col-md-12">

<input type="hidden" value="'.$site_id.'" id="site">
<input type="hidden" value="'.$block.'" id="block">
<input type="hidden" value="'.$student_id.'" id="student_id">
<select class="form-control"  id="room" onkeypress="allocate()" style="lenght:100%" autofocus required placeholder="Username (Email Address:)">
<option></option>
';


$q = "SELECT * FROM hostel_rooms WHERE block_id = '$block' AND campus_id='$site_id' ORDER BY RAND() ";
$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 'No block available';
}
      echo '</select></div><br><br><br>
      <center>
      <button class="btn btn-success glyphicon glyphicon-ok back" onclick="allocate()" name="submit">
      Click Here to Allocate!
      </button>
      <br>
      </center><br><br>
      <div id="qqq"></div>';


?>
