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

<?php

     $conn = new mysqli("localhost","root","","event");
	$name = ($_POST['name']);
	
	$address = ($_POST['address']);
	$phone = ($_POST['phone']);
	
	
	$event = ($_POST['event']);
	$rs = ($_POST['rs']);
	
$filename= $_FILES["upload"]["name"];
$tmpname= $_FILES["upload"]["tmp_name"];
$folder ="parsonal_event_img/".$filename;
move_uploaded_file($tmpname, $folder);

	//$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 `ragistar`(`id`, `name`, `age`, `gender`, `email`, `salary`, `qualification`) VALUES ([$fname],[$fage],

	//[$fgender],[$fEmail],[$fsalary],[$fQualification])";
	
	
	$insert = "insert into add_personal_event (name,address,phone,event,rs,image)  
	values ('".$name."','".$address."','".$phone."','".$event."','".$rs."','".$folder."')";
	$confirmation = mysqli_query($conn,$insert);
			while($user_details = mysqli_fetch_assoc($result)){
				session_start();
				$_SESSION['user_details'] = $user_details;
				$_SESSION['fname'] = $user_details;
				header('Location: wedding plarners.php');
			}



			if($confirmation){
				header('Location: parsonal_events_display.php');
			}
		
	else{
		echo "Kindly click on Register button to complete the form process";
	}
	


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