<?php
 	session_start(); 

	if(!isset($_SESSION['tulsilogin']))
	{
		header('Location: index.php');
		return;
	}



$_SESSION['_token']=bin2hex(openssl_random_pseudo_bytes(16));
	
	
	include("connect.php");
	include("connectp.php");
$packagemid=$_POST['packagemid'];
	
	$query="delete from res_packagewisebookset_detail where packagemid=$packagemid";
	$result= mysqli_query($conn, $query) or die("Error");
	
	
	
	$booksetmid=$_POST['booksetmid'];
	$attechment="";
	
	
	foreach ($booksetmid as $one_by_one_sid) 
					{
					
					
					 $sql1="Insert into res_packagewisebookset_detail (packagemid,booksetmid) values (?,?)";
					$stmt1= $db7->prepare($sql1);
				$stmt1->execute([$packagemid,$one_by_one_sid]);
					}
		
		
	
			
	$_SESSION['msg'] = "Record saved successfully";
	header('Location: packagewisebookset.php');
			
	
?>