<?php
if (isset($_POST['submitcontact'])) {
	$name=$_POST['yourname'];
	$email=$_POST['email'];
	$phone=$_POST['cno'];
	$sub=$_POST['sub'];
	$msg=$_POST['message'];
	$word = "http"; 
if(strpos($msg, $word) !== false){

	header('Location:contact.html');
   exit; 
}

	$headers='From:'.$email."\n".'Reply-To:'.$email."\n".	
    'X-Mailer: PHP/' . phpversion()."\n".'content-type :text/html;charset=UTF-8';
	$message='<br>Name: '.$name.'<br>Email: '.$email.'<br>Phone: '.$phone.'<br>Subject: '.$sub.'<br>Message: '.$msg.'<br>';
	
	if(mail('matrix.realtysolutions@gmail.com','enquiry mail',$message,$headers))
		{
      echo "<script>alert('Thank you for sharing your details !');</script>";
      echo "<script>document.location.href='contact.php'</script>";
      }
      else
      {
      echo "<script>alert('Mail was not sent. Please try again later');</script>";
      }

	// header('Location:contact.html?Massage=sent');
}

?>


<?php
if (isset($_POST['submit-agent'])) {
	$name=$_POST['name'];
	$email=$_POST['eamil'];
	$phone=$_POST['phone'];
	
	$msg=$_POST['message'];
	$word = "http"; 
	if(strpos($msg, $word) !== false){

	header('Location:contact.php');
   exit; 
}

	$headers='From:'.$email."\n".'Reply-To:'.$email."\n".	
    'X-Mailer: PHP/' . phpversion()."\n".'content-type :text/html;charset=UTF-8';
	$message='<br>Name: '.$name.'<br>Email: '.$email.'<br>Phone: '.$phone.'<br>Subject: '.$msg.'<br>';
	
	if(mail('matrix.realtysolutions@gmail.com','enquiry mail',$message,$headers))
		{
      echo "<script>alert('Thank you for sharing your details !');</script>";
      echo "<script>document.location.href='index.php'</script>";
      }
      else
      {
      echo "<script>alert('Mail was not sent. Please try again later');</script>";
      }

	// header('Location:contact.php?Massage=sent');
}

?>




