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

?>


<?php

     $conn = new mysqli("localhost","root","","event");
	
	$massage = ($_POST['massage']);
	$user_id=	($_SESSION['user_details']['id']);
	
	//$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 feedback (user_id,massage)  
	values ('".$user_id."','".$massage."')";
	
	$confirmation = mysqli_query($conn,$insert);
	
			if($confirmation){
				echo "<script>window.top.location='http://localhost/event_managment_system/feedbackcreate.php';setTimeout(function(){alert('Your Feedback is Sent.');},2000);</script>";
			}
		
	else{
		echo " not not";
	
	}
	


?>
<?php
  }
  else{
    echo "you cant directly access the page without the session running.";
  }
  
?>