 <?php 
 
 $msg1="";
$msg2="";

if(isset($_POST['submit']))
{					
		$name = $_POST['fullname'];
		$comp_name = $_POST['companyname'];
		/* $address = $_POST['address'];
		if(strlen($_POST['website'])!=0)
		     $website = $_POST['website'];
		else
			$website = "--------"; */
		$email = $_POST['email'];
		$contact = $_POST['contact'];
		$message = $_POST['message'];
		$recaptcha=$_POST['g-recaptcha-response'];
		
		if($name=='')
		{
		  $msg1="Please enter the name";
		}
		elseif($email=='') 
		{
		  $msg1="please enter the email id"; 
		}
		else
		{
		   if(!empty($recaptcha))
		   {
					include("getCurlData.php");
					$google_url="https://www.google.com/recaptcha/api/siteverify";
					$secret='6LcPHRUTAAAAAKBpcMtonCfYXJAtONIzsxbqDkD0'; // Secrete key
					$ip=$_SERVER['REMOTE_ADDR'];
					$url=$google_url."?secret=".$secret."&response=".$recaptcha."&remoteip=".$ip;
					$res=getCurlData($url);
					$res= json_decode($res, true);
					if($res['success'])
					{	
					   
					$message_body = '<html><body>';
					$message_body .= '<h3>Contact Details :</h3><table rules="all" style="border:1px solid #000000;" cellpadding="10">';
					$message_body .= "<tr style='background: #eee;'><td colspan='2'><strong>Contact Information Details :</strong> </td></tr>";
					$message_body .= "<tr><td><strong>Name:</strong> </td><td>" .$name. "</td></tr>";
					$message_body .= "<tr><td><strong>Company Name:</strong> </td><td>" .$comp_name. "</td></tr>";
					//$message_body .= "<tr><td><strong>Address:</strong> </td><td>" .$address. "</td></tr>";
					$message_body .= "<tr><td><strong>Contact No.:</strong> </td><td>" .$contact. "</td></tr>";
					$message_body .= "<tr><td><strong>Email Id:</strong> </td><td>" .$email. "</td></tr>";
					//$message_body .= "<tr><td><strong>Website:</strong> </td><td>" .$website. "</td></tr>";
					$message_body .= "<tr><td><strong>Message:</strong> </td><td>" .$message. "</td></tr>";
					$message_body .= "</table>";
					$message_body .= "</body></html>";
					
					//$to="suryatechnocrats@gmail.com";
					$to="yogesh@omwebsolution.com";
					$from="info@suryatechnocrats.com";
						
					$subject = 'Generate Enquiry for Surya Technocrats';
					
					$headers = "From: " . $from . "\r\n";
					//$headers .= "Reply-To: ". strip_tags($_POST['req-email']) . "\r\n";
					$headers .= "MIME-Version: 1.0\r\n";
					$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
					
					mail($to, $subject, $message_body, $headers);
					$msg2="Thank you for contacting us";
				}
				else{
				 echo 'mail could not send';
				}
		
		   }else{
			$msg1="Please re-enter your reCAPTCHA.";
		   }
		 }
}


 ?>
   <!-- captcha -->
	<script src='https://www.google.com/recaptcha/api.js'></script>
 <h2><strong>Quick</strong> Contact</h2>	
 <p><?php  if($msg1!=''){echo '<span style="color:red; font-size:20px;">'.$msg1.'</span>';}elseif($msg2!=''){echo '<span style="color:green; font-size:20px;">' .$msg2. '</span>';}?></p>
 <form action="" method="post">
	  <fieldset>
		<p class="" ><input name="fullname" class="input_bg" type="text" id="name" value="" pattern="[a-z A-Z.,]+" placeholder="Full Name*" required/></p>
		<p class="" ><input name="companyname" class="input_bg" type="text" id="company" value="" placeholder="Company Name" /></p>
		<p class="" ><input name="email" class="input_bg" type="email" id="email" value="" placeholder="E-Mail*" required/></p>
		<p><input name="contact" class="input_bg" type="text" id="contact" value="" placeholder="Contact No.*" pattern="[0-9]+" required/></p>
		<p class=""><textarea name="message" class="textarea_bg" id="message" cols="20" rows="4" placeholder="Enquiry Details*" required></textarea></p>
		<div class="clearfix"></div>
		<p><!-- Site key: 6LcPHRUTAAAAAD9mi3qJeG3fM7ZzEBKRtfJ8fW5v
									Secret key: 6LcPHRUTAAAAAKBpcMtonCfYXJAtONIzsxbqDkD0 -->
		<div class="g-recaptcha" data-sitekey="6LcPHRUTAAAAAD9mi3qJeG3fM7ZzEBKRtfJ8fW5v"></div> <br/>
		
		<input name="submit" type="submit" value="SUBMIT" class="but_calendar" id="send"/></p>
	  </fieldset>
	</form>
	<div class="clearfix divider_line4"></div>
	<div class="clearfix"></div>
