<?php
//$_SERVER['HTTP_REFERER'];
if(isset($_POST['email']))
{
	$name=$_POST['name'];
	$email=$_POST['email'];
	$mobileno=$_POST['phone'];
	$location=$_POST['location'];

	$to = "rajinder.kanojia79@gmail.com";
	$subject = "Enquiry From kidsmalish.in";
	$message = " Name: " . $name ."\r\n Email: " . $email."\r\n Mobile No: " . $mobileno . "\r\n Location: " . $location;
	if(empty($email))$email=$to;
	$from = $email;
	$headers = "From:" . $from . "\r\n";
	$headers .= "Content-type: text/plain; charset=UTF-8" . "\r\n"; 
	 
	if(@mail($to,$subject,$message,$headers))
	{
	  echo "<script>alert('Thanks! Your Message was sent successfully,we will connect soon !')</script>";
	  echo "<script>window.location='$_SERVER[HTTP_REFERER]'</script>";
	}
	else{
	echo "<script>alert('Error! Please try again.')</script>";	
	echo "<script>window.history.back()</script>";
	}
}
?>