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


$userid=$_SESSION["userid"];

$month_name=$_POST["month_name"];
$rt=$_POST["rt"];
if($_POST['delete']) // from button name="delete"
	{
		$checkbox = $_POST['checkbox']; //from name="checkbox[]"
		$countCheck = count($_POST['checkbox']);
		
		for($i=0;$i<$countCheck;$i++)
		{
			$del_id  = $checkbox[$i];
			$userid=$_SESSION["userid"];
			$today=date("d-m-Y");
			$sqlp14 = "select * from admission where id='$del_id' and user_id='$userid'";
 							$finishstock=mysql_query($sqlp14) or die("Error : " . mysql_error());
   							$app1=mysql_fetch_array($finishstock);
   							$std_rollno=$app1["std_rollno"];
							$std_name=$app1["std_name"];
							$class_name=$app1["class_name"];
							$bal=$app1["bal"];
							$cell_1=$app1["cell_1"];
			
			 
		$sql2="update admission set bal='0' where id='$del_id' and user_id='$userid';";
	mysql_query($sql2) or die("Error : " . mysql_error());
			
	
	
	$sql3 = "Insert into rec_fee (id,date,std_rollno,std_name,class_name,month_name,total_fee,paid_fee,bal_fee,user_id,rt) values (null,'$today','$std_rollno','$std_name','$class_name','$month_name','$bal','$bal','0','$userid','$rt')";
mysql_query($sql3) or die("Error : " . mysql_error());
			
		}
			if($result)
		{	
				header('Location: t_r_fee.php');
			}
			else
			{
				echo "Record Save";
			}
	}
  
	
	

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





?>
<a href="rec_fee.php"> Back </a>