<?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");
$query="delete from res_commondocument_master ";
	$result= mysqli_query($conn, $query) or die("Error");
		
	$documentmid=$_POST['documentmid'];
	$attechment="";
	
	
	foreach ($documentmid as $one_by_one_sid) 
					{
					
					
					 $sql1="Insert into res_commondocument_master (documentmid) values (?)";
					$stmt1= $db7->prepare($sql1);
				$stmt1->execute([$one_by_one_sid]);
					}
					
					$_SESSION['msg'] = "Record saved successfully";
	header('Location: commondocument.php');
?>