<?php
session_start(); 

	if(!isset($_SESSION['tulsilogin']))
	{
		header('Location: index.php');
		return;
	}
	


	$_SESSION['_token']=bin2hex(openssl_random_pseudo_bytes(16));
	
	include("connect.php");

	
	//$visatype=$_POST['visatype'];
	$lfname=str_replace ("'","\'",$_POST['lfname']);
	$lfname=str_replace ('"','\"',$lfname);
	
	$lfmiddlename=str_replace ("'","\'",$_POST['lfmiddlename']);
	$lfmiddlename=str_replace ('"','\"',$lfmiddlename);
	
	$lfsurname=str_replace ("'","\'",$_POST['lfsurname']);
	$lfsurname=str_replace ('"','\"',$lfsurname);
	
	$lfgender=str_replace ("'","\'",$_POST['lfgender']);
	$lfgender=str_replace ('"','\"',$lfgender);
	
	//$imstatus="Followup";
	
	$lfaddress=str_replace ("'","\'",$_POST['lfaddress']);
	$lfaddress=str_replace ('"','\"',$lfaddress);
	

	
	
	
	$lfemail=str_replace ("'","\'",$_POST['lfemail']);	
	$lfemail=str_replace ('"','\"',$lfemail);
	
	$lfmobile=str_replace ("'","\'",$_POST['lfmobile']);	
	$lfmobile=str_replace ('"','\"',$lfmobile);
	$mobilecode=$_POST['mobilecode'];
	$lfmobile="+".$mobilecode." ".$lfmobile;
	
	$imid=$_POST['imid'];
	
	
	$lfcountry='';
	$lfcountry=str_replace ("'","\'",$_POST['lfcountry']);
	$lfcountry=str_replace ('"','\"',$lfcountry);
	$lfstate='';
	$lfstate=str_replace ("'","\'",$_POST['lfstate']);
	$lfstate=str_replace ('"','\"',$lfstate);
	
	$lfpostcode=str_replace ("'","\'",$_POST['lfpostcode']);
	$lfpostcode=str_replace ('"','\"',$lfpostcode);
	
	
	$lfcity='';
	$lfcity=str_replace ("'","\'",$_POST['lfcity']);
	$lfcity=str_replace ('"','\"',$lfcity);
	
	
	
	
	
	
	/* $imdetails=str_replace ("'","\'",$_POST['pdetails']);
	$imdetails=str_replace ('"','\"',$imdetails);
	 */
	$lfrelation=str_replace ("'","\'",$_POST['lfrelation']);
	$lfrelation=str_replace ('"','\"',$lfrelation);
	
	
	
	
	date_default_timezone_set("Asia/Kolkata");
	$mdate= date('Y-m-d H:i:s');
	
	
	//$ippassword=$_POST['ippassword'];			
	
	//$istudentcategory=trim($_POST['istudentcategory']);
	
 	 $eve1 = "INSERT INTO res_leadfamily_detail (lfname, lfaddress, lfemail, lfmobile, lfgender,  lfcountry, lfcity,lfrelation,lfmiddlename,lfsurname,lfpostcode,lfstate,imid) VALUES('$lfname','$lfaddress','$lfemail','$lfmobile','$lfgender','$lfcountry','$lfcity','$lfrelation','$lfmiddlename','$lfsurname','$lfpostcode','$lfstate','$imid')";

	
	if ($conn->query($eve1) === TRUE)
	{
		
			
		
	
		$_SESSION['msg'] = "Record saved successfully";
	}
	else
	{
		$_SESSION['msg1'] = "Error";
	}
	header('Location: inquirydetail.php?id='.$imid.'&tab=student_familydetail');
?>