<?php
if(isset($_POST['submit']))
{
		if(empty($_SESSION['6_letters_code'] ) ||
	  strcasecmp($_SESSION['6_letters_code'], $_POST['6_letters_code']) != 0)
	{
	//Note: the captcha code is compared case insensitively.
	//if you want case sensitive match, update the check above to
	// strcmp()
		$errors .= "\n The captcha code does not match!";
	}
	
	$name = $_POST['name'];
	$email = $_POST['email'];
	$phone = $_POST['contactt'];
	$msg = $_POST['message'];
	
	$to = array('support@webdesignlaboratory.com');
	$subject = "Contact Info";
	
	$message = '<center><h1>CONTACT INFO</h1></center>
    <table width="447" height="247" align="center">
       	<tr>
           	<td width="137">Name :- </td>
            <td width="247">'.$name.'</td>
        </tr>
		<tr>
           	<td>Email :- </td>
            <td>'.$email.'</td>
        </tr>
        <tr>
           	<td>phone :- </td>
            <td>'.$phone.'</td>
        </tr>
		<tr>
           	<td>msg :- </td>
            <td>'.$msg.'</td>
        </tr>
        
        
</table>';
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= 'From: No-Reply <no-reply@webdesignlaboratory.com/>' . "\r\n";

if(mail(implode(',', $to),$subject,$message,$headers))
	{
	
?>
<script>alert('Your Message Sent Successfully');</script>
<script>window.location="https://webdesignlaboratory.com";</script>
<?php
		
	}
	else
	{
?>

<script>alert('An Error Occured While Sending Email.. Please try Again');</script>
<script>window.location="https://webdesignlaboratory.com";</script>
<?php
	}
	?>
	
<?php
}
else
{
	echo "something went wrong";
}
?>