<?php include "header.php"; ?>
<div id="page-wrapper">

            <div class="row">
                <!-- Page Header -->
                <div class="col-lg-12">
<style>
h1{
font-size:14px;
color:#FF0000;
text-align:center;}</style>
<table width="400"  border="0" cellpadding="1" cellspacing="1" align="center" >
 
  <tr>
    <td class="up_h"><div align="center">
<?php
$id=$_POST['id'];$day=$_POST['day'];$month=$_POST['month'];$year=$_POST['year'];$marital_status=$_POST['marital_status'];$sr_no=$_POST['sr_no'];$date_join=$_POST['date_join'];$name=$_POST['name'];$f_h_name=$_POST['f_h_name'];$d_of_b=$_POST['d_of_b'];$phone_h=$_POST['phone_h'];$phone_m=$_POST['phone_m'];$email=$_POST['email'];$image=$_POST['image'];$perma_add=$_POST['perma_add'];$gender=$_POST['gender'];$prse_add=$_POST['prse_add'];$year_p_hse=$_POST['year_p_hse'];$div_hse=$_POST['div_hse'];$per_hse=$_POST['per_hse'];$moi_hse=$_POST['moi_hse'];$board_hse=$_POST['board_hse'];$info_hse=$_POST['info_hse'];$year_p_i=$_POST['year_p_i'];$div_i=$_POST['div_i'];$per_i=$_POST['per_i'];$moi_i=$_POST['moi_i'];$board_i=$_POST['board_i'];$info_i=$_POST['info_i'];$gradu_type=$_POST['gradu_type'];$year_p_g=$_POST['year_p_g'];$div_g=$_POST['div_g'];$per_g=$_POST['per_g'];$moi_g=$_POST['moi_g'];$board_g=$_POST['board_g'];$info_g=$_POST['info_g'];$pgradu_type=$_POST['pgradu_type'];$year_p_p=$_POST['year_p_p'];$div_p=$_POST['div_p'];$per_p=$_POST['per_p'];$moi_p=$_POST['moi_p'];$board_p=$_POST['board_p'];$info_p=$_POST['info_p'];$year_p_o=$_POST['year_p_o'];$div_o=$_POST['div_o'];$per_o=$_POST['per_o'];$moi_o=$_POST['moi_o'];$board_o=$_POST['board_o'];$info_o=$_POST['info_o'];$experiences=$_POST['experiences'];$hobbies=$_POST['hobbies'];$d_salary=$_POST['d_salary'];$exp_salary_m=$_POST['exp_salary_m'];$exp_salary_min=$_POST['exp_salary_min'];$name_well_f=$_POST['name_well_f'];$add_well_f=$_POST['add_well_f'];$name_well_s=$_POST['name_well_s'];$add_well_s=$_POST['add_well_s'];
$newname=$_POST['newname'];
$aano=$_POST['aano'];
$vidc=$_POST['vidc'];
 define ("MAX_SIZE","100"); 

 function getExtension($str) {
         $i = strrpos($str,".");
         if (!$i) { return ""; }
         $l = strlen($str) - $i;
         $ext = substr($str,$i+1,$l);
         return $ext;
 }


 $errors=0;
 if(isset($_POST['Submit'])) 
 {
 	
 	$image=$_FILES['image']['name'];
 	
 	if ($image) 
 	{
 		$filename = stripslashes($_FILES['image']['name']);
  		$extension = getExtension($filename);
 		$extension = strtolower($extension);

 if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif")) 
 		{
 			echo '<h1>Unknown extension!</h1>';
 			$errors=1;
 		}
 		else
 		{

 $size=filesize($_FILES['image']['tmp_name']);

if ($size > MAX_SIZE*9024)
{
	echo '<h1>You have exceeded the size limit!</h1>';
	$errors=1;
}
$image_name=time().'.'.$extension;
$newname="images/".$image_name;
//echo "$newname";
$copied = copy($_FILES['image']['tmp_name'], $newname);
if (!$copied) 
{
	echo '<h1>Copy unsuccessfull!</h1>';
	$errors=1;
}}}}

 if(isset($_POST['Submit']) && !$errors) 
 {
 	echo "<h1>File Uploaded Successfully! Try again!</h1>";
 }

 ?>
 
<?php

$query = "UPDATE add_teachers SET day='$day', month='$month', year='$year', marital_status='$marital_status', sr_no='$sr_no', date_join='$date_join', name='$name', f_h_name='$f_h_name', d_of_b='$d_of_b', phone_h='$phone_h', phone_m='$phone_m', email='$email',image='$newname', perma_add='$perma_add', gender='$gender', prse_add='$prse_add', year_p_hse='$year_p_hse', div_hse='$div_hse', per_hse='$per_hse', moi_hse='$moi_hse', board_hse='$board_hse', info_hse='$info_hse', year_p_i='$year_p_i', div_i='$div_i', per_i='$per_i', moi_i='$moi_i', board_i='$board_i', info_i='$info_i', gradu_type='$gradu_type', year_p_g='$year_p_g', div_g='$div_g', per_g='$per_g', moi_g='$moi_g', board_g='$board_g', info_g='$info_g', pgradu_type='$pgradu_type', year_p_p='$year_p_p', div_p='$div_p', per_p='$per_p', moi_p='$moi_p', board_p='$board_p', info_p='$info_p', year_p_o='$year_p_o', div_o='$div_o', per_o='$per_o', moi_o='$moi_o', board_o='$board_o', info_o='$info_o', experiences='$experiences', hobbies='$hobbies', d_salary='$d_salary', exp_salary_m='$exp_salary_m',exp_salary_min='$exp_salary_min', name_well_f='$name_well_f', add_well_f='$add_well_f', name_well_s='$name_well_s', add_well_s='$add_well_s', aano='$aano', vidc='$vidc', session='$session', session='$session' WHERE id=$id and session='$session' and code='$code'";
$result = mysql_query( $query );
 if ( ! $result )
die ("Couldn't update: ".mysql_error());
?>
  <?php print "<h1>Table Updated ". mysql_affected_rows() .
" row(s) updated</h1>"?>

<br /><br /><br /><br /><br /><br />
<Div align="center"><img src="images/row_updated.jpg" /></Div><br /><br />
<?php
echo "<a href=\"view_teacher.php\"><img src='images/ok.jpg' /></a>";
?></div></td></tr></table>
 </div></div></div>
<?php 
include "footer.php"; ?>