<?php 
  $fieldd=$_POST['fieldd']; 
  $fieldc=$_POST['fieldc']; 
  if((isset($fieldd)) && (isset($fieldc)) && ($fieldc==$fieldd))
  {
  
  
  $name=$_POST['name'];  
  $email=$_POST['email'];
  $mobile=$_POST['mobile'];
//   $subject=$_POST['subject'];
  $message=$_POST['message'];

  $ref= isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
  $subject="Enquiry Form ". " " .$name;
  
  if($name=='' || $name=='Name'){ echo "<span style=color:red>Enter a Valid Name</span>  <a href=".$ref.">Go Back</a>"; }
  else{
  
  $message='<table width=100% border=0 border-color:none cellspacing=3 cellpadding=3 class=text style="font-family:Arial; line-height:160% word-spacing:0.4em font-size:14px; border: 1px solid" bgcolor="#F9F9F9" color:"#465864">
  <tr >
  <td colspan="4"  align="center" bgcolor="#CCCCCC" ><strong >Enquiryp Form '.$name.'</strong></td>
  </tr>
    <tr><td>First Name</td><td>:</td><td >'.$name.'</td></tr> 
    <tr><td>Email Id</td><td>:</td><td>'.$email.'</td></tr>
    <tr><td>Mobile No </td><td>:</td><td>'.$mobile.'</td></tr>
    // <tr><td>Subject </td><td>:</td><td>'.$subject.'</td></tr>   
    <tr><td>Message </td><td>:</td><td>'.$message.'</td></tr>
  </table>'; 
  
  
      
  //echo $message; exit();
  
  $senderemail = "alagupandiyaraj@clouddreams.co.in";
  $headers  = 'MIME-Version: 1.0' . "\r\n";
  $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  /*$headers .= 'From: '.$Emailid;
  */
  if(@mail($senderemail,$subject,"$message",$headers))
  {
    $url="mail-success.html";
    header("Location: ". $url);
    
  }
  else
  {
    $url="mail-sent-error.html";
    header("Location: ". $url);
    
  } 
  
  }
  }
  else
  {
    $url="mail-sent-error.html";
    header("Location: ". $url);
    
  } 
  
  ?>