<?php session_start();
if($_SESSION){
?>

<?php session_start();
if($_SESSION){

?>


<?php

     $conn = new mysqli("localhost","root","","event");
     $id = ($_POST['id']);
     $customer_name = ($_POST['customer_name']);
	$name = ($_POST['name']);
	$place = ($_POST['place']);
	$date =date("Y-m-d", strtotime($_POST['date']));
	$eqi1_string = implode(', ', $_POST['eqi1']);
	
	$guests = ($_POST['guests']);
	$eqi2_string = implode(', ', $_POST['eqi2']);
	$user_id=	($_SESSION['user_details']['id']);
	$rs =( $_POST['main_price']);
	
	//$Date = test_input($_POST['Date']);
	//$joining  = test_input($_POST['joining']);


	function test_input($data) {
  $data = trim($data);
  $data = stripslashes($data);
  $data = htmlspecialchars($data);
  $data = mysql_real_escape_string($data);
  return $data;
}


	 
	
	$insert = "insert into book (user_id,	customer_name,name, date_, place, eqi1, guests, eqi2 ,rs)  
	values ('".$id."','".$customer_name."','".$name."','".$date."','".$place."','". $eqi1_string ."','".$guests."','".$eqi2_string."','".$rs."')";
	
	$confirmation = mysqli_query($conn,$insert);
	}
			if($confirmation){
				header('Location:display2.php');
			}
		
	else{
		header('Location:Customer_book_an_event.php');
	
	}
	


?>
<?php
  }
  else{
    echo "<script>
   alert('You have to  login first...!');
   window.location.href='event2.php';
   </script>";
  }
  
?>