<?php
session_start();
include 'dbc.php';

date_default_timezone_set("Asia/Karachi");
$today=date("Y-m-d");
$month = date("m",strtotime($today));
		$year = date("Y",strtotime($today));
		 $month_name = date("F", mktime(0, 0, 0, $month, 10));
		 $my=$month_name . " " . $year;
$username=$_SESSION["username"];
$userid=$_SESSION["userid"];
$saldate=$_POST["saldate"];
$month_name=$_POST["month_name"];
$sess1=$_POST["sess1"];

$size = count($_POST['monthly_salary']);
$i = 0;
while ($i < $size) {
$id= $_POST['id'][$i];
	$tech_name = $_POST['tech_name'][$i];
	 $father_name = $_POST['father_name'][$i];
	  $class_name = $_POST['class_name'][$i];
	  $monthly_salary = $_POST['monthly_salary'][$i];


	$idate= $_POST['idate'][$i];
	$iamount = $_POST['iamount'][$i];
	$remarks = $_POST['remarks'][$i];
	
	$netbsal= $monthly_salary + $iamount;
	  
			
	$sql1 = "update teacher set 
monthly_salary='$netbsal' where id='$id'";
$conn->query($sql1);
$sql = "Insert into inc_sal (id,date,month_name,sess1,teacher_id,tech_name,father_name,class_name,monthly_salary,idate,iamount,netamount,user_id,remarks) values (null,'$today','$month_name','$sess1','$id','$tech_name','$father_name','$class_name','$monthly_salary','$idate','$iamount','$netbsal','$userid','$remarks')";
$conn->query($sql);

	++$i;

// do the update and print out some info just to provide some visual feedback


} 

header("location:Edit_Del_Teacher.php");
//echo"<td> <a href ='open_customers.php?areaname=$party_area'>Click to Main Dashboard</a>";
?>
