<?php
if(isset($_POST['submit'])){
	$to = "alphachequers@gmail.com"; // Your email address
	$name = $_POST['name'];
	$from = $_POST['email'];
	$question = $_POST['question'];
	$message = $_POST['message'];
	$subject = "Contact Form Details";
	$headers = "From:" . $from;
	$result = mail($to,$subject,$message,$headers);

	if(!empty($name) && !empty($from) && !empty($question) && !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;
}
}
?>