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

<?php
	 $conn = new mysqli("localhost","root","","event");
	$name= ($_POST['name']);
	$email= ($_POST['email']);
	$phone= ($_POST['phone']);
	$city= ($_POST['city']);
	$event= ($_POST['event']);

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

	$insert = "insert into contact (name,email,phone,city,event)  
	values ('".$name."','".$email."','".$phone."','".$city."','".$event."')";
	
	
	
	$confirmation = mysqli_query($conn,$insert);


	
			if($confirmation){
				echo "<script>window.top.location='contact.php';{alert('Your massage is Sent.');};</script>";
				
				//header('Location: contact.php');
			}
		
	else{
		echo " not not";
	
	}
	


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