<script type="text/javascript">
$(document).ready(function(e) {
$("#faculty").on('submit' ,(function(e) {
e .preventDefault();
$("#message").empty();
$('#loading').show();
$ .ajax({
url : "control.php" , //Url to which the request issend
type : "POST" , //Type of request to be send,called as method
data : new FormData(this), //Data sent to server, a set of key/value pairs(i.e.form fields and values)
contentType : false, //The content type used when sending data to the server.
cache : false , //To unable request pages to be cached
processData : false, //To send DOMDocument or non processed data file it is set to false
beforeSend : function(){
            $('#loading').show();
        },
success: function(data) //A function to be called if request succeeds
{
$('#loading').hide();
document.getElementById('inputHere').innerHTML = data;
$('#myModal').modal('show');
document.getElementById('fname').value = "";
}
});
}));
});
</script>
                  <div class="x_content">
                    <div class="well">
                    <div class="row">
                  <?php
                  $select0 = $conn->query("SELECT * FROM stp WHERE packageid = '$vlink' AND studentid != '$id2'");
                      $fetch = $select0->fetchAll(PDO::FETCH_OBJ);
                      $count = $select0->rowCount();
                      if ($count > 0) {
                        foreach ($fetch as $value) {
                          $stuid = $value->studentid;
                          $select0 = $conn->query("SELECT * FROM students WHERE id = '$stuid'");
                          $fetch = $select0->fetchAll(PDO::FETCH_OBJ);
                          $count = $select0->rowCount();
                          $serial = 1;
                          if ($count > 0) {
                            foreach ($fetch as $value2) {
                              $stuid = $value2->id;
                              $sname = $value2->sname;
                              $oname = $value2->oname;
                              $matric = $value2->matric;

                        ?>
                        <div class="col-md-3">
                           <div class="panel panel-default"style="height: 300px;">
                              <div class="panel-body">
                                    <img src="images/user.png" alt="..." class="img-circle profile_img">
                                    <h3 class="text-center"><?php echo "$sname $oname"; ?></h3>
                              </div>
                           </div> 
                        </div>
                        <?php
                            }
                          }

                        }
                      }else{
                    ?>
                    <h2>No Course Mates yet</h2>
                    <?php
                      }
                  ?>

                </div>
            </div>
            </div>

<div class="modal fade" id="myModal" role="dialog">
    <div class="modal-dialog modal-sm">
      <div class="modal-content">
        <div class="modal-body text-center">
        <div id="inputHere">

        </div>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">Ok</button>
        </div>
      </div>
    </div>
  </div>
</div>
