<?php 
ob_start();
error_reporting(0);
session_start();
include_once("dbconnect.php");
$cnt=mysql_query("select * from countries where country_id=".$_POST['countries']);
$cnt1=mysql_fetch_array($cnt);
$country=$cnt1['country_name'];

$stt=mysql_query("select * from states where state_id=".$_POST['state']);
$stt1=mysql_fetch_array($stt);
$state=$stt1['state_name'];
$city=$_POST['City'];
 if($_POST['6_letters_code']==$_SESSION['6_letters_code'])
{
 $to = "archakam.p@gmail.com";
 $subject = "Consultation Form";

$message ='<table height="40%" width="60%" align="" border="10" cellpadding="5" cellspacing="5" bgcolor="#FFCC99">
                      <tbody>
                       <tr>
                          <td width="80%" colspan="3" align="center" class="cntnt" style="font-weight: bold; text-align: center">Wedding Priest</td>
                          </tr>
						   <tr>
                          <td width="38%" align="center" class="cntnt"><span class="style9">Care of Name</span></td>
                          <td class="cntnt" width="9%" align="center">:</td>
                          <td width="53%" height="30">'.$_POST['cname'].'</td>
                        </tr>
						 <tr>
                          <td width="38%" align="center" class="cntnt"><span class="style9">Care of Email</span></td>
                          <td class="cntnt" width="9%" align="center">:</td>
                          <td width="53%" height="30">'.$_POST['cemail'].'</td>
                        </tr>
						 <tr>
                          <td width="38%" align="center" class="cntnt"><span class="style9">Care of Phone</span></td>
                          <td class="cntnt" width="9%" align="center">:</td>
                          <td width="53%" height="30">'.$_POST['cphone'].'</td>
                        </tr>
                        <tr>
                          <td width="38%" align="center" class="cntnt"><span class="style9">Name</span></td>
                          <td class="cntnt" width="9%" align="center">:</td>
                          <td width="53%" height="30">'.$_POST['firstname'].'</td>
                        </tr>
						  <tr>
                          <td width="38%" align="center" class="cntnt"><span class="style9">Address</span></td>
                          <td class="cntnt" width="9%" align="center">:</td>
                          <td width="53%" height="30">'.$_POST['address'].'</td>
                        </tr>
						 <tr>
                          <td class="cntnt" align="center"><span class="style9">Phone Number</span></td>
                          <td class="cntnt" align="center">:</td>
                          <td height="30">'.$_POST['pnumber'].'</td>
                        </tr>
						<tr>
                          <td class="cntnt" align="center"><span class="style9">Email</span></td>
                          <td class="cntnt" align="center">:</td>
                          <td height="30">'.$_POST['email'].'</td>
                        </tr>
						<tr>
                          <td class="cntnt" align="center"><span class="style9">Country</span></td>
                          <td class="cntnt" align="center">:</td>
                          <td height="30">'.$country.'</td>
                        </tr>
						<tr>
                          <td class="cntnt" align="center"><span class="style9">State</span></td>
                          <td class="cntnt" align="center">:</td>
                          <td height="30">'.$state.'</td>
                        </tr>
						<tr>
                          <td class="cntnt" align="center"><span class="style9">City</span></td>
                          <td class="cntnt" align="center">:</td>
                          <td height="30">'.$city.'</td>
                        </tr>
						<tr>
                          <td class="cntnt" align="center"><span class="style9">City</span></td>
                          <td class="cntnt" align="center">:</td>
                          <td height="30">'.$_POST['neartown'].'</td>
                        </tr>
						<tr>
                          <td class="cntnt" align="center"><span class="style9">Date Of Birth</span></td>
                          <td class="cntnt" align="center">:</td>
                          <td height="30">'.$_POST['dofbirth'].'</td>
                        </tr>
						<tr>
                          <td class="cntnt" align="center"><span class="style9">Birth Of Time</span></td>
                          <td class="cntnt" align="center">:</td>
                          <td height="30">'.$_POST['doftime'].' : '.$_POST['dofsec'].' '.$_POST['dofampm'].'</td>
                        </tr>
						<tr>
                          <td class="cntnt" align="center"><span class="style9">Consult</span></td>
                          <td class="cntnt" align="center">:</td>
                          <td height="30">'.$_POST['services'].'</td>
                        </tr>
						<tr>
                          <td class="cntnt" align="center"><span class="style9">Message</span></td>
                          <td class="cntnt" align="center">:</td>
                          <td height="30">'.$_POST['message'].'</td>
                        </tr>
                       </tbody>
                    </table>';
	//echo $message;exit;

// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
// Additional headers
$abc= substr($_POST['firstname'],0,8);
// More headers
$headers .= 'From: '.$abc.  "\r\n";
// Mail it

mail($to,$subject,$message,$headers);


header("location:thanku1.php");


}
else {

	$_SESSION['msg']="The Validation code does not match!";
		header("location:Vaastu.php");
	}
?>
