<?php 
//print_r($_POST);exit();
$error="";

if(!isset($_POST['name']) || $_POST['name']=="")
{
	$error .="\nName is required";
}

else
{
	if(!preg_match('/^[a-zA-Z\\s]*$/',$_POST['name']))
	{
		$error .="\nEnter valid Name";
	}
}


if(!isset($_POST['phone']) || $_POST['phone']=="")
{
	$error .="\Phone no is required";
}

if(!isset($_POST['message']) || $_POST['message']=="")
{
	$error .="\Message is required";
}


if ($error == "") {
    $to = 'platinumgroup.socialmedia@gmail.com, backupilogicx@gmail.com';
    $subject = 'Enquiry  Form';

    $message_body = "<html><body><table border=5px>";
    $message_body .= "<tr><td colspan='2' style='color : #C50B33; font-size : 20px; '><b>Request For Enquiry  </b></td></tr>";
    $message_body .= "<tr><td>Contact's Full Name : </td><td>" . $_POST['name'] . "</td></tr>";
    $message_body .= "<tr><td>Contact's Phone : </td><td>" . $_POST['phone'] . "</td></tr>";
    $message_body .= "<tr><td>Contact's Message : </td><td>" . $_POST['message'] . "</td></tr>";
    $message_body .= "</table></body></html>";

    $headers = "MIME-Version: 1.0" . "\r\n";
    $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
    $headers .= 'From: lpplatinum devenvir' . "\r\n";

    if (mail($to, $subject, $message_body, $headers)) {
        echo "sent";
    } else {
        echo "Sorry, an error occurred this time sending your mail. Please send again..!";
    }
} else {
    echo $error;
}
?>