<?php
if(isset($_POST['submit'])){
	$to = "widetour3030@gmail.com"; // Your email address
	$firstname = $_POST['fname'];
	$lastname = $_POST['lname'];
	$from = $_POST['email'];
	$phone = $_POST['phone'];
	$no_of_nights = $_POST['no_of_nights'];
	$destination = $_POST['destination'];
	$travel_date = $_POST['travel_date'];
	$call_back_date = $_POST['call_back_date'];
	$budget = $_POST['budget'];
	$adults = $_POST['adults'];
	$children = $_POST['children'];
	
	$message = $_POST['message'];
	$subject = "Tour Booking Details";
	$headers = "From:" . $from;
	
	$msg = $subject . "\r\n" . 
	       "First Name: " . $firstname . "\r\n" . 
	       "Last Name: " . $firstname . "\r\n" . 
		   "Email: " . $from . "\r\n" .
		   "Phone: " . $phone . "\r\n" . 
		   "No of Nights: " . $no_of_nights . "\r\n" . 
		   "Destination: " . $destination . "\r\n" . 
		   "Preferred Travel Date: " . $travel_date . "\r\n" . 
		   "Preferred Call Back Time (in-hours): " . $call_back_date . "\r\n" . 
		   "Budget: " . $budget . "\r\n" . 
		   "Adult: " . $adults . "\r\n" . 
		   "Children: " . $children . "\r\n" .     
           "message: " . $message ;
	
	$result = mail($to,$headers,$msg);

	if(!empty($firstname) && !empty($lastname) && !empty($no_of_nights) && !empty($destination) && !empty($travel_date) && !empty($budget) && !empty($adults) && !empty($children) && !empty($message) && !empty($phone) && !empty($from) && !empty($question) && !empty($message)){
	
	if ($result) {
		header('location: book_trip.php?success=msgsnt');
		exit;		

	}else{
		header('location: book_trip?error=msgntsnt');
		exit;		
	}
}else{
	header('location: book_trip?error=dataEmpty');
		exit;
}
}
?>