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


$userid=$_SESSION["userid"];

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("Y-m-d");
			
			$sql = "SELECT * FROM widraw where id = '$del_id' and user_id='$userid'";
$result=$conn->query($sql);
$row = $result->fetch_assoc();
$adm_no=$row['adm_no'] ;
$portal_id=$row['portal_id'] ;
$std_rollno=$row['std_rollno'] ;
$adm_date=$row['adm_date'] ;
$dob=$row['dob'] ;
$cls_sec=$row['cls_sec'] ;
$class_name=$row['class_name'] ;
$std_name=$row['std_name'] ;
$fname=$row['fname'] ;
$fnic=$row['fnic'] ;
$mnic=$row['mnic'] ;
$cell_1=$row['cell_1'] ;
$cell_2=$row['cell_2'] ;
$gender=$row['gender'] ;
$address=$row['address'] ;
$remarks=$row['remarks'] ;
				$mfee=$row['mfee'] ;
		$bal=$row['bal'] ;
			
			$sql1 = "Insert into admission (id,date,adm_no,portal_id,std_rollno,adm_date,dob,class_name,cls_sec,std_name,fname,fnic,mnic,cell_1,cell_2,gender,address,mfee,bal,remarks,user_id,status) values (null,'$today','$adm_no','$portal_id','$std_rollno','$adm_date','$dob','$class_name','$cls_sec','$std_name','$fname','$fnic','$mnic','$cell_1','$cell_2','$gender','$address','$mfee','$bal','$remarks','$userid','Active')";
$conn->query($sql1);


		$sql11 = "delete from widraw where id='$del_id'";
$conn->query($sql11);
			
	
	
	
			
		}
			if($result)
		{	
				header('Location: Open_Widraw_Students.php');
			}
			else
			{
				header('Location: maindashboard.php');
			}
	}
  
	
	

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





?>
