<?php   
    require "commonincludefiles.php";

if ($_SESSION['cCompany_id']!="" && isset($_SESSION['cCompany_id'])) {
	      $studid=json_decode(stripslashes($_REQUEST['studentid']));
	      $detailid=json_decode(stripslashes($_REQUEST['detailid']));
		  $deleteid=json_decode(stripslashes($_REQUEST['deleteid']));
          $objSubjectSelectionMgmt= new SubjectSelectionMgmt();
		  $delids = "";
		  
		for($i=0;$i<count($deleteid);$i++)
		 {
		 	$delids .= $deleteid[$i]. ",";
		 }
		 
		 $delids = substr($delids,0,strlen($delids)-1);
		 $objSubjectSelectionMgmt->deletsubjectselection_id = $delids;
		 $objSubjectSelectionMgmt->delete();
		 
		 for($i=0;$i<count($studid);$i++)
		 {			
		 			
					$objSubjectSelectionMgmt->student_id	 =$studid[$i];
					$objSubjectSelectionMgmt->examsetupdetail_id	=str_replace("E","",$detailid[$i]);
					$objSubjectSelectionMgmt->add();
		 }
		 echo '{"success":"true"}';
	
}	
 ?>