<?php

if(isset($_POST['search_keyword']))
{//if if it has and if it doesnt

	 $search_keyword =  $_POST['search_keyword'];

}
	?>
<div class="well">

      <ul class="tabs">

        <li><a href="#view1">Support System</a></li>

      </ul>
      <div class="tabcontents">
        <div id="view1" style="min-height:200px;">


                <ul class="breadcrumb">
                    <li><a href="gateway.php?act=view_supports">Support Menu</a> <span class="divider"></span></li>
                    <li class="active"> Student Support</li>
                </ul>


              <?php //echo view_subjects(); ?>



              <!-- <form class="form-horizontal" action="gateway.php?act=view_support_student" role="search" method="get" enctype="multipart/form-data">
              -->            <fieldset>
                            <legend>Search Student </legend>

                      <!-- <input type="hidden" name="MAX_FILE_SIZE" value="MAX_FILE_SIZE" />-->
                      <div class="form-group">

                        <!--<span class="label label-primary"><label class="control-label" for="textarea">Permanent Home Address (if different from above)
                        </label></span>-->

                           <div class="input-group">
                                <input style="height:50px;" id="search_keyword" class="form-control auto" type="text" placeholder="Search" name="search_keyword"
                                value="<?php if(isset($search_keyword)){ echo $search_keyword;}?>" />



                                <div class="input-group-addon"><button type="submit" class="btn btn-success" name="submit">GO</button> </div>

                            </div>



                </fieldset>
                </form>

                <!--  end of the form  -->

            <!-- check if search keyword has value , if not dont sho anything -->
            <?php
						$search_keyword="";
				if($search_keyword != '')
				{
					$q = "SELECT `id`, `group_id`, `role_id`, `type_id`, `cart_id`, `faculty_id`, `department_id`, `programme_id`,
					`state_id`, `lga_id`, `hostel_id`, CONCAT_WS(' ',`first_name`, `other_names`) as name, `gender`, `number`, `username`, `password`,
					 `email`, `birthdate`, `phone_number`, `security_id`, `address`, `image`, `mode_of_entry`, `user_status`,
					 `online_status`, `ontoken`, `last_login_ip`, `last_login`, `last_logout`, `town`, `level`, `status`, `validity_status`,
					 `date_trashed`, `date_added`, `date_modified`, `added_by`, `modified_by`

					  FROM `students` WHERE number LIKE '%$search_keyword%'";

						 $result = mysqli_query($dbc, $q);


						 if(mysqli_num_rows($result)>0)
						 {

						while( $row =  mysqli_fetch_array($result, MYSQLI_ASSOC))
						{

			?>


            <div class=""><!-- container -->
            	<div class="row">



                            <table id="background-image">

                              <thead>
                                  <tr>
                                      <th style="background:none;" scope="col"></th>
                                      <th style="background-image:none;" scope="col"></th>
                                  </tr>
                              </thead>
                              <tfoot></tfoot>
                              <tbody>

                                          <?php
                                          $output = '<tr>';
											$output .= "<td><h3><a href='#=".$row['id']."'>".$row['name']."</a></h3>
															<h4 ><span class='label label-success'>Faculty: ".get_faculty_title($row['faculty_id'])."</span></h4>
															<h4><span class='label label-success'>Department: ".get_department_title($row['department_id'])."</span></h4>
															<h5><span class='label label-success'>Programme: ".get_programme_title($row['programme_id'])."</span></h5>
															<h5><span class='label label-success'>Level: ".$row['level']."</span></h5>
															</td>";
											$output .= "<td><a href='#=".$row['id']."'><img src='../students/uploads/pictures/".$row['image']."' /></a></td>";
											$output .= "</tr>";

											//return the output
											echo $output;

											?>
                                      </tbody>

                          </table>

                    </div>




      		<?php
						 }//end of while


						 }
						 else //else of data doesnt exist
						 {
			?>


                           <div class="alert alert-danger">
                              <button class="close" data-dismiss="alert" type="button">
                                  X

                              </button>
                              <img src="../images/info.png" />  Oops! No match found....
                          </div>

                          <?php
						 } //end of if data doesnt match
						  ?>

			<?php
            	}// end of if not empty
			?>


                </div><!-- /row-->

            </div><!-- /container -->







        </div> <!-- end of viiew 1 -->


      </div>
</div>

</form>


 <!-- JUI Required for search input -->
<link rel="stylesheet" href="auto_complete_search/jquery_ui/css/jquery-ui.css">
<script src="auto_complete_search/jquery_ui/js/jquery-ui.js"></script>



<!-- JavaScripts Required for Search Form -->
<script src="auto_complete_search/js/search.js"></script>



 <!--plugins for search - if not online allow to run so  search box can auto complete-->
<script type="text/javascript" src="auto_complete_search/js/jquery-ui.min.js"></script>
