<?php
$field_name = $_POST['name'];
$field_email = $_POST['email'];
$field_phone = $_POST['phone'];
$subject = $_POST['subject'];
$field_agree = $_POST['AGREE_TO_TERMS'];
$field_msg = $_POST['message'];
$mail_to = 'vibhu2392@gmail.com';
$subject = $_POST['subject'];
$body_message = 'Name: '.$field_name."\n";
$body_message .= 'E-mail: '.$field_email."\n";
$body_message .= 'Phone Number: '.$field_phone."\n";
if($field_agree==1){
	$agree='Yes';
}
else{
	$agree='No';
}
$body_message .= 'Message: '.$field_msg."\n";
$body_message .= 'Agree to terms: '.$agree;
$headers = 'From: '.$field_email."\r\n";
$headers .= 'Reply-To: '.$field_email."\r\n";

$mail_status = mail($mail_to, $subject, $body_message, $headers);

if ($mail_status) { ?>

	<script language="javascript" type="text/javascript">
		alert('Thank you for enquiry. Have a nice day!');

		window.location = 'index.html';
	</script>
<?php
}
else { ?>
 
	<script language="javascript" type="text/javascript">
		alert('Please try again');

		window.location = 'index.html';
	</script>
<?php
}
?>