<?php
error_reporting(0); 

$email=$_POST['email'];
if(isset($_POST['submit']))
{
$error = array();
if($_POST['name'] == ""){
$error[] = "Enter A Name";
}
$email=$_POST['email'];
if (!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/", $email)){ 
$error[] = "Entered Email Address Is Not Valid.";
} 
if($_POST['subject'] == ""){
$error[] = "Enter A Subject";
}
if($_POST['contact'] == ""){
$error[] = "Enter A Phone Number";
} 
if($_POST['comments'] == ""){
$error[] = "Enter A Message";
} 
if($error){
	foreach($error as $listerror){
	echo $listerror;	
	}
//header("location:error.html");
} else {
	$to='info@monthlyseo.services.com';	 	
	$subject = 'Your Contact Details'; 
	$message="<div style='width:700px; float:none; margin:0 auto; font-family:Arial, Helvetica, sans-serif; border:solid 1px #e5e5e5; padding:5px;'>
  <h1 style='background:#0067f4;text-align:center; margin:0px; padding:15px 0px; border:solid 1px #e5e5e5;'><span style='color:#ffffff;'>Monthly SEO Services</span></h1>
  <div style='clear:both;'></div>
  <br />
  <div style='border:solid 1px #e5e5e5; padding:5px;'>
    <table style='font-family:Arial, Helvetica, sans-serif; font-size:13px; border-collapse:collapse; border-color:#e5e5e5; color:#959595;' border='1' width='100%' cellpadding='10' cellspacing='5'>
      <tr>
        <td width='20%'><strong style='color:#0067f4;'>Name :</strong></td>
        <td width='80%'> $_POST[name]</td>
      </tr>
      <tr>
        <td width='20%'><strong style='color:#0067f4;'>Email :</strong></td>
        <td width='80%'> $_POST[email]</td>
      </tr>
	  <tr>
        <td width='20%'><strong style='color:#0067f4;'>Phone Number :</strong></td>
        <td width='80%'> $_POST[contact]</td>
      </tr>
      <tr>
        <td width='20%'><strong style='color:#0067f4;'>Subject :</strong></td>
        <td width='80%'> $_POST[subject]</td>
      </tr> 
	  <tr>
        <td width='20%'><strong style='color:#0067f4;'>Message :</strong></td>
        <td width='80%'> $_POST[comments]</td>
      </tr>
    </table>
    <div style='clear:both;'></div>
    <br />
    <hr />
    <p style='font-family:Arial, Helvetica, sans-serif; font-size:13px; margin:0px; padding:15px; text-align:center; color:#959595;'>&copy; <a href='javascript:;' target='_blank' style='color:#0067f4; text-decoration:none;'>Monthly SEO Services</a>. All Rights Reserved.</p>
  </div>
</div>";	 
      $headers .= "From: <sales@supersupportstaff.com>\r\n"; 		
	  $headers .= "Organization: Sender Organization\r\n";
	  $headers .= "MIME-Version: 1.0\r\n";
	  $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
	  $headers .= "X-Priority: 3\r\n";
	  $headers .= "X-Mailer: PHP". phpversion() ."\r\n"; 
	  $send = mail($to,$subject,$message,$headers);	
		$to1=$email;	
		$subject1 = 'Welcome to Monthly SEO Services'; 
		$message1="<div style='width:700px; float:none; margin:0 auto; font-family:Arial, Helvetica, sans-serif; border:solid 1px #e5e5e5; padding:5px;'>
	  <h1 style='background:#0067f4;text-align:center; margin:0px; padding:15px 0px; border:solid 1px #e5e5e5;'><span style='color:#ffffff;'>Monthly SEO Services</span></h1>
	  <div style='clear:both;'></div>
	  <div style='border:solid 1px #e5e5e5; padding:5px; line-height:23px; text-align:center;'>
		<p style='font-family:Arial, Helvetica, sans-serif; font-size:18px; color:#555555;'><span style='color:#0067f4;'>Thank you for contacting us.</span> <br /><br /> We have received your enquiry and we will get back to you within 24 hours...</p>
		<div style='clear:both;'></div>
		<br /><br />
		<hr />
		<p style='font-family:Arial, Helvetica, sans-serif; font-size:13px; margin:0px; padding:15px; text-align:center; color:#959595;'>&copy; <a href='javascript:;' target='_blank' style='color:#0067f4; text-decoration:none;'>Monthly SEO Services</a>. All Rights Reserved.</p>
	  </div>
	</div>";
	  $headers1 .= "From: <sales@supersupportstaff.com>\r\n"; 		
	  $headers1 .= "Organization: Sender Organization\r\n";
	  $headers1 .= "MIME-Version: 1.0\r\n";
	  $headers1 .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
	  $headers1 .= "X-Priority: 3\r\n";
	  $headers1 .= "X-Mailer: PHP". phpversion() ."\r\n"; 
	  $send = mail($to1,$subject1,$message1,$headers1);

		function storeAddress(){	
		if(!$_POST['email']){ return "No email address provided"; } 
		if(!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$/i", $_POST['email'])) {
			return "Email address is invalid"; 
		} 	
		$list_id = "264d3be589";
		$email=$_POST['email'];		
}
storeAddress();
	if($send){
 	echo "<script>document.location.href='thankyou.html'</script>";
	} else {
	echo "mail not send";	
	}
}
}
?>