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


$userid=$_SESSION["userid"];

if($_POST['delete']) // from button name="delete"
	{
		$checkbox = $_POST['checkbox'];
		$class_name = $_POST['class_name']; //from name="checkbox[]"
		$countCheck = count($_POST['checkbox']);
		
		for($i=0;$i<$countCheck;$i++)
		{
			$del_id  = $checkbox[$i];
			$userid=$_SESSION["userid"];
			$today=date("Y-m-d");
			$sql = "update items set 
type_name='$class_name' where id='$del_id'";
$conn->query($sql);
$sql1 = "update invoice_details set 
type_name='$class_name' where itemcode='$del_id'";
$conn->query($sql1);
$sql2 = "update purchase_details set 
type_name='$class_name' where itemcode='$del_id'";
$conn->query($sql2);
			/*$sqlp14 = "select * from admission where id='$del_id'";
 							$result=$conn->query($sqlp14);
   							$test=mysql_fetch_array($finishstock);
   							$std_name=$test['std_name'] ;
				$std_rollno= $test['std_rollno'] ;					
				$father_name=$test['father_name'] ;
				$class_name=$test['class_name'] ;
				$allied_code=$test['allied_code'] ;
				
				$dob=$test['dob'] ;
				
				$home_adress=$test['home_adress'] ;
				$camp=$test['camp'] ;
				$cell_1=$test['cell_1'] ;
				$cell_2=$test['cell_2'] ;
				$monthly_fee=$test['monthly_fee'] ;
				$annual_fee=$test['annual_fee'] ;
		$code=$test['code'] ;
		$bal=$test['bal'] ;
			
			 $sql = "Insert into admission1 (id,date,std_rollno,std_name,father_name,dob,class_name,home_adress,cell_1,cell_2,monthly_fee,annual_fee,user_id,code,bal,camp,fno,allied_code) values (null,'$today','$std_rollno','$std_name','$father_name','$dob','$class_name','$home_adress','$cell_1','$cell_2','$monthly_fee','$annual_fee','$userid','$code','$bal','$camp','$fno','$allied_code')";
mysql_query($sql) or die("Error : " . mysql_error());

		$sql11 = "delete from admission where id='$del_id'";
mysql_query($sql11) or die("Error : " . mysql_error());
			*/
	
	
	
			
		}
			if($result)
		{	
				header('Location: Open_Active_Students.php');
			}
			else
			{
				header('Location: Edit_Type_Items.php');
			}
	}
  
	
	

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





?>
