<?php
if(isset($_POST['submit'])){
	$to = "alphachequers@gmail.com"; // Your email address
	$name = $_POST['name'];
	$from = $_POST['email'];
	$phone = $_POST['phone'];
	$message = $_POST['msg'];
	$subject = "Contact Form Details";
	$headers = "From:" . $from;
	$result = mail($to,$subject,$message,$headers);

	if(!empty($name) && !empty($from) && !empty($phone) && !empty($message)){
	
	if ($result) {
		header('location: contact.php?success=msgsnt');
		exit;		

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