<?php
if(isset($_POST['token'])){

		include_once('../../../db_connect/db.php');
		include_once('functions.php');
		$student_id = $_POST["token"];
		$type_id = $_POST["type_id"];

		if($type_id=='1')
		{
			$sqlmg=mysqli_query($conn_1, "SELECT * FROM students_prence WHERE  id='$student_id' ") or die(mysqli_error());


										if($sqlmg){
											$sqlmg_row=mysqli_num_rows($sqlmg);
												if($sqlmg_row >0){

													while($row=mysqli_fetch_assoc($sqlmg)){

														$first_name=$row['first_name'];
														$middle_name=$row['middle_name'];
														$other_names=$row['other_names'];
														$phone_no=$row['phone_no'];
														$gender=$row['gender'];
														$number=$row['number'];
														$application_number=$row['application_number'];
														$email=$row['email'];
														$phone_number=$row['phone_number'];
														$student_id=$row['id'];

														$name = $first_name.' '.$middle_name.' '.$other_names;

													}
												}
										}

		}else if($type_id=='2')
		{
			$sqlmg=mysqli_query($conn_1, "SELECT * FROM students_nce WHERE  id='$student_id' ") or die(mysqli_error());


										if($sqlmg){
											$sqlmg_row=mysqli_num_rows($sqlmg);
												if($sqlmg_row >0){

													while($row=mysqli_fetch_assoc($sqlmg)){

														$first_name=$row['first_name'];
														$middle_name=$row['middle_name'];
														$other_names=$row['other_names'];
														$phone_no=$row['phone_no'];
														$gender=$row['gender'];
														$number=$row['number'];
														$application_number=$row['application_number'];
														$email=$row['email'];
														$phone_number=$row['phone_number'];
														$student_id=$row['id'];

														$name = $first_name.' '.$middle_name.' '.$other_names;

													}
												}
										}

		}else if($type_id=='3')
		{
			$sqlmg=mysqli_query($conn_2, "SELECT * FROM students_nce WHERE  id='$student_id' ") or die(mysqli_error());


										if($sqlmg){
											$sqlmg_row=mysqli_num_rows($sqlmg);
												if($sqlmg_row >0){

													while($row=mysqli_fetch_assoc($sqlmg)){

														$first_name=$row['first_name'];
														$middle_name=$row['middle_name'];
														$other_names=$row['other_names'];
														$phone_no=$row['phone_no'];
														$gender=$row['gender'];
														$number=$row['number'];
														$application_number=$row['application_number'];
														$email=$row['email'];
														$phone_number=$row['phone_number'];
														$student_id=$row['id'];

														$name = $first_name.' '.$middle_name.' '.$other_names;

													}
												}
										}

		}else if($type_id=='4')
		{

			$sqlmg=mysqli_query($conn_2, "SELECT * FROM students_udus WHERE  id='$student_id' ") or die(mysqli_error());


										if($sqlmg){
											$sqlmg_row=mysqli_num_rows($sqlmg);
												if($sqlmg_row >0){

													while($row=mysqli_fetch_assoc($sqlmg)){

														$first_name=$row['first_name'];
														$middle_name=$row['middle_name'];
														$other_names=$row['other_names'];
														$phone_no=$row['phone_no'];
														$gender=$row['gender'];
														$number=$row['number'];
														$application_number=$row['application_number'];
														$email=$row['email'];
														$phone_number=$row['phone_no'];
														$student_id=$row['id'];

														$name = $first_name.' '.$middle_name.' '.$other_names;

													}
												}
										}

		}else if($type_id=='5')
		{
			$sqlmg=mysqli_query($conn_1, "SELECT * FROM summer_students WHERE  id='$student_id' ") or die(mysqli_error());


										if($sqlmg){
											$sqlmg_row=mysqli_num_rows($sqlmg);
												if($sqlmg_row >0){

													while($row=mysqli_fetch_assoc($sqlmg)){

														$first_name=$row['first_name'];
														$middle_name=$row['middle_name'];
														$other_names=$row['other_names'];
														$phone_no=$row['phone_no'];
														$gender=$row['gender'];
														$number=$row['number'];
														$application_number=$row['application_number'];
														$email=$row['email'];
														$phone_number=$row['phone_number'];
														$student_id=$row['id'];

														$name = $first_name.' '.$middle_name.' '.$other_names;

													}
												}
										}

		}else if($type_id=='6')
		{
			$sqlmg=mysqli_query($conn_1, "SELECT * FROM summer_students WHERE  id='$student_id' ") or die(mysqli_error());


										if($sqlmg){
											$sqlmg_row=mysqli_num_rows($sqlmg);
												if($sqlmg_row >0){

													while($row=mysqli_fetch_assoc($sqlmg)){

														$first_name=$row['first_name'];
														$middle_name=$row['middle_name'];
														$other_names=$row['other_names'];
														$phone_no=$row['phone_no'];
														$gender=$row['gender'];
														$number=$row['number'];
														$application_number=$row['application_number'];
														$email=$row['email'];
														$phone_number=$row['phone_number'];
														$student_id=$row['id'];

														$name = $first_name.' '.$middle_name.' '.$other_names;

													}
												}
										}

		}



}



?>
<form method="POST" id="edit_form_faculty" >

				<input id="student_id" name="student_id" type="hidden" class="form-control required" value="<?=$student_id;?>" required />
				<input id="type_id" name="type_id" type="hidden" class="form-control required" value="<?=$type_id;?>" required />

				<div class="form-group row">
				<label for="title" class="col-sm-3 col-form-label text-right">Name : (*)
				</label>
					<div class="col-sm-9">
						<input id="title" name="name" type="text"
						placeholder="Student Names " class="form-control required" value="<?=$name;?>" disabled />
					</div>
             </div>

			 <div class="form-group row">
				<label for="title" class="col-sm-3 col-form-label text-right">Matric No : (*)
				</label>
					<div class="col-sm-9">
						<input id="Code" name="mat_no" type="text"
						placeholder="Matric Number " class="form-control required" value="<?=$number;?>" disabled />
					</div>
             </div>

			 <div class="form-group row">
				<label for="email" class="col-sm-3 col-form-label text-right">Application No
				</label>
					<div class="col-sm-9">
						<input id="email" name="app_no" type="email"
						placeholder="Application Number" value="<?=$application_number;?>" class="form-control" disabled/>
					</div>
             </div>


			 <div class="form-group row">
				<label for="location" class="col-sm-3 col-form-label text-right">Phone No
				</label>
					<div class="col-sm-9">
						<input id="text" name="tel" type="text"
						placeholder="Phone Number " value="<?=$phone_number;?>" class="form-control" disabled />
					</div>
             </div>

			 <div class="form-group row">
				<label for="Email" class="col-sm-3 col-form-label text-right">Email
				</label>
					<div class="col-sm-9">
						<input id="text" name="email" type="text"
						placeholder="Email " value="<?=$email;?>" class="form-control"  disabled/>
					</div>
          </div>
					<div class="form-group row">
	 				<label for="Gender" class="col-sm-3 col-form-label text-right">Gender
	 				</label>
	 					<div class="col-sm-9">
							<select class="form-control" name="gender" required>
									<?php echo select_gender($gender);?>
							</select>
	 					</div>
	           </div>



						<div id="button_edit">
							<center>
														<button class="button button-3d button-primary button-rounded btn_3d" type="submit">Update
												</button>
						</div>
             </form>

			 <center>
				<div id="output_error_edit">

				</div>
			</center>
