<?php
	include_once('includes/connect_database.php'); 
?>
	<?php 
		if(isset($_GET['id'])){
			$ID = $_GET['id'];
		}else{
			$ID = "";
		}

		if(isset($_POST['remark']))
		{
			$remark=addslashes($_POST['remark']);
			$sql_query="UPDATE tbl_student SET remark = ? WHERE id = ?";
		    $stmt = $connect->stmt_init();
		    if($stmt->prepare($sql_query))
		    {
		    	$stmt->bind_param('ss',$remark,$ID);
		    	$stmt->execute();
		    	$stmt->close();
		    	$suc=1;
		    }	

		}
		
		// create array variable to store data from database
		
		// get all data from menu table and category table
		$sql_query = "SELECT id,student_name,
		student_dob,
		mobile,
		email,
		guardian,
		mobile_guardian,
		email_guardian,
		address,
		city,state,other,
		ten_board,
		ten_studyyear,
		ten_schoolname,
		ten_marks,
		twelve_studyyear,
		twelve_schoolname,
		twelve_marks,twelve_board,twelve_result,course,mode,looking_for_scholarship,remark,created FROM tbl_student
					WHERE id = ? ";
		
		$stmt = $connect->stmt_init();
		if($stmt->prepare($sql_query)) {	
			// Bind your variables to replace the ?s
			$stmt->bind_param('s', $ID);
			// Execute query
			$stmt->execute();
			// store result 
			$stmt->store_result();
			$stmt->bind_result($data['id'], 
					$data['student_name'], 
					$data['student_dob'], 
					$data['mobile'], 
					$data['email'],
					$data['guardian'],
					$data['mobile_guardian'],
					$data['email_guardian'],
					$data['address'],
					$data['city'],$data['state'],$data['other'],
					$data['ten_board'],
					$data['ten_studyyear'],
					$data['ten_schoolname'],
					$data['ten_marks'],
					$data['twelve_studyyear'],
					$data['twelve_schoolname'],
					$data['twelve_marks'],
					$data['twelve_board'],
					$data['twelve_result'],
					$data['course'],
					$data['mode'],
					$data['looking_for_scholarship'],$data['remark'],$data['created']
					);
			$stmt->fetch();
			$stmt->close();
		}
		
	?>

					<section class="content-header">
        <div class="">
                        <!-- left column -->
                        <div class="col-md-12">
                    
         <h1>Student Detail  			<a href="studentlist.php"><button class="btn btn-primary pull-right">Student List</button></a>
</div></div>
                   </section>
<section class="content">
                    <div class="row">
                        <!-- left column -->
                        <div class="col-md-6">
                            <!-- general form elements -->
                            <div class="box box-primary">
                            	<div class="box-body table-responsive">

                            		<div class="nav-tabs-custom">
<ul class="nav nav-tabs">
<li class="active"><a href="#tab_1" data-toggle="tab">Personal Information</a></li>
<li><a href="#tab_2" data-toggle="tab">Education Qualification</a></li>
<li><a href="#tab_3" data-toggle="tab">Your Interest In NSIC</a></li>

</ul>
<div class="tab-content">
                                    <div class="tab-pane active" id="tab_1">
	<table  class='table table-bordered table-condensed'>
		<tr>
				<th style="width:20%">ID</th>
				<td><?php echo "FW202023".str_pad($data['id'],3,'0',STR_PAD_LEFT); ?></td>
			</tr>
			<tr>
				<th class="detail">Student Name</th>
				<td class="detail"><?php echo $data['student_name']; ?></td>
			</tr>
				<tr>
				<th class="detail">student D.O.B</th>
				<td class="detail"><?php echo date('Y-m-d',strtotime($data['student_dob'])); ?></td>
			</tr>
			<tr>
				<th class="detail">Mobile no</th>
				<td class="detail"><?php echo $data['mobile']; ?></td>
			</tr>

			<tr>
				<th class="detail">Email Id</th>
				<td class="detail"><?php echo $data['email']; ?></td>
			</tr>

			<tr>
				<th class="detail">Guardian Name</th>
				<td class="detail"><?php echo $data['guardian']; ?></td>
			</tr>
			<tr>
				<th class="detail">Mobile - Guardian</th>
				<td class="detail"><?php echo $data['mobile_guardian']; ?></td>
			</tr>
			<tr>
				<th class="detail">Email Id - Guardian</th>
				<td class="detail"><?php echo $data['email_guardian']; ?></td>
			</tr>
			<tr>
				<th class="detail">Address</th>
			    <td class="detail"><?php echo $data['address']; ?></td>
			</tr>
			<tr>
				<th class="detail">City</th>
			    <td class="detail"><?php echo $data['city']; ?></td>
			</tr>
			<tr>
				<th class="detail">State</th>
			    <td class="detail"><?php echo $data['state']; ?></td>
			</tr>
			<tr>
				<th class="detail">Other</th>
			    <td class="detail"><?php echo $data['other']; ?></td>
			</tr><tr><th class="detail">Walk-In Date</th><td class="detail"><?php echo date('d-m-Y',strtotime($data['created'])); ?></td></tr>
			
	</table>

</div>


     <div class="tab-pane " id="tab_2">
     	<table  class='table table-bordered table-condensed'>
     			<tr><td colspan="2"> <h4><b>Class 10th</b></h4></td></tr>
     		<tr>
				<th class="detail" style="width:20%">Board</th>
			    <td class="detail"><?php echo $data['ten_board']; ?></td>
			</tr>
			<tr>
				<th class="detail">Year of Study</th>
			    <td class="detail"><?php echo $data['ten_studyyear']; ?></td>
			</tr>
			<tr>
				<th class="detail">School Name</th>
			    <td class="detail"><?php echo $data['ten_schoolname']; ?></td>
			</tr>
			<tr>
				<th class="detail">Marks/Grade</th>
			    <td class="detail"><?php echo $data['ten_marks']; ?></td>
			</tr>
				<tr><td colspan="2"> <h4><b>Class 12th</b></h4></td></tr>
     		<tr>
				<th class="detail">Board</th>
			    <td class="detail"><?php echo $data['twelve_board']; ?></td>
			</tr>
			
     		<tr>
				<th class="detail">Year of Study</th>
			    <td class="detail"><?php echo $data['twelve_studyyear']; ?></td>
			</tr>
			<tr>
				<th class="detail">School Name</th>
			    <td class="detail"><?php echo $data['twelve_schoolname']; ?></td>
			</tr>
			
			<tr>
				<th class="detail">Marks/Grade</th>
			    <td class="detail"><?php echo $data['twelve_marks']; ?></td>
			</tr>
			
<tr>
				<th class="detail">12th Standard Result</th>
			    <td class="detail"><?php echo $data['twelve_result']; ?></td>
			</tr>
			
	</table>
</div>


     <div class="tab-pane " id="tab_3">
	<table  class='table table-bordered table-condensed'>
			<tr>
				<th class="detail" style="width:20%">Course</th>
			    <td class="detail"><?php echo $data['course']; ?></td>
			</tr>
			<tr>
				<th class="detail">Looking For Scholarship</th>
			    <td class="detail"><?php echo $data['looking_for_scholarship']; ?></td>
			</tr>
	<tr>
				<th class="detail" style="width:20%">Mode</th>
			    <td class="detail"><?php echo $data['mode']; ?></td>
			</tr>

	</table>


</div>

   </div>


                            		
	<div class="box-footer">
			<a href="studentlist.php"><button class="btn btn-primary">Student List</button></a>
		<!--	<a href="delete-menu.php?id=<?php echo $ID; ?>"><button class="btn btn-danger">Delete</button></a>
	--></div>
	
	</div>

</div>
	<div class="separator"> </div>
</div></div>
<div class="col-sm-6">
<div class="box box-primary">
<div class="box-body table-responsive">
<form action="" method="post" />

<?php if($suc==1)
{
?>
<div class="alert alert-success" id="success-alert">
  <strong>Success!</strong> Remark Saved Successfully.
</div>

<?php
$suc=0;
}?>
<div class="col-sm-12">
	<label>Remark:</label>
	</div>
<div class="col-sm-12">
<textarea placeholder="Remark" name="remark" col="15" rows="6" style="width:100%"><?php echo $data['remark']; ?></textarea></div>
<div class="col-sm-12"><br/><input type="submit" value="Submit" class="btn btn-primary" /></div>
</form>
<div class="clearfix"></div>
</div>
</div>
				</div>
</div>
</section>
<?php include_once('includes/close_database.php'); ?>