<?php
 	session_start(); 

	if(!isset($_SESSION['linkarisecrm']))
	{
		header('Location: index.php');
		return;
	}
	include("connect.php");
	$brmid=$_SESSION['linkarisebranchid'];
	$cmpmid=$_SESSION['linkarisecmpmid'];
	$spotname=$_POST['spotname'];
	$spotaddress=$_POST['spotaddress'];
	$cpmobile=$_POST['cpmobile'];
	$cpname = $_POST['cpname'];
	$spotcapacity=$_POST['spotcapacity'];
	$spotfacility=$_POST['spotfacility'];
	$slotmid=$_POST['slotmid'];
	
				
				 $eve1 = "INSERT INTO res_spot_master (spotname,spotaddress,spotcpname,cpmobile,spotcapacity,spotfacility,cmpmid) VALUES('$spotname','$spotaddress','$cpname','$cpmobile','$spotcapacity','$spotfacility','$cmpmid')";
				if ($conn->query($eve1) === TRUE)
				{
					$last_id = $conn->insert_id;
					$delete_checkbox_array = $_POST['slotmid'];
				foreach ($delete_checkbox_array as $one_by_one_sid)
				{		
					$slotmid=$one_by_one_sid;
					
					$eve3 = "INSERT INTO res_spot_detail (spotmid,slotmid,cmpmid) VALUES($last_id,$slotmid,'$cmpmid')";
					if ($conn->query($eve3) === TRUE)
					{}
				}
		
				$_SESSION['msg'] = "Data successfully added.";
			
				}
				else{
					$_SESSION['msg1'] = "Error";

				}
		
	header('Location: hall.php');
	
?>