<?php

// Uncomment the following two lines to troublshoot errors
//ini_set( 'display_errors', 1 );
//error_reporting( E_ALL );
	
if(isset($_POST['email'])) {
 
     
 
    // EDIT THE 2 LINES BELOW AS REQUIRED
 
    //$email_to = "WKFS-InfoDevSupport@wolterskluwer.com";
 
    //$email_subject = "Documentation Feedback";
 
     
 
     
 
    function died($error) {
 
        // your error code can go here
        
        echo "<span style='font-family: Segoe UI'>";
 
        echo "Sorry, but there were one or more errors found with the form you submitted.";
 
        echo "These errors appear below.<br /><br />";
 
        echo $error."<br /><br />";
 
        echo "Please <a href='#' onclick='history.go(-1)'>go back</a> and fix these errors.<br /><br />";
        
        echo "</span>";
 
        die();
 
    }
 
     
 
    // validation expected data exists
 
    if(!isset($_POST['full_name']) ||
 
        !isset($_POST['email']) ||
 
        !isset($_POST['telephone']) ||
 
        !isset($_POST['comments'])) {
 
        died('We are sorry, but there appears to be a problem with the form you submitted.');       
 
    }
    
    // check value of Contact Me checkbox
    if (isset($_POST['ContactMe'])) {
        // Checkbox is selected
        $Contact = "Yes";
    } else {
       // Alternate code
       $Contact = "No";
    }
 
     
 
    $txtUrl = $_POST['txtUrl']; // not required
    $full_name = $_POST['full_name']; // required
    $company = $_POST['company']; // not required
    $email_from = $_POST['email']; // required
    $contact = $_POST['ContactMe']; // not required
    $telephone = $_POST['telephone']; // not required
    $product = $_POST['product']; // not required
    $comments = $_POST['comments']; // required
 
     

    $error_message = "";
 
    $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
 
  if(!preg_match($email_exp,$email_from)) {
 
    $error_message .= '<li>The Email Address you entered does not appear to be valid.</li><br />';
 
  }
 
    $string_exp = "/^[A-Za-z .'-]+$/";
 
  if(!preg_match($string_exp,$full_name)) {
 
    $error_message .= '<li>The Name you entered does not appear to be valid.</li><br />';
 
  }
 
  if(strlen($comments) < 2) {
 
    $error_message .= '<li>The Comments you entered do not appear to be valid.</li><br />';
 
  }
 
  if(strlen($error_message) > 0) {
 
    died($error_message);
 
  }
 
    //$email_message = "The following feedback was received using the Feedback form within the InfoDev online documentation.<br/><br/>" ;
 
     
 
    function clean_string($string) {
 
      $bad = array("content-type","bcc:","to:","cc:","href");
 
      return str_replace($bad,"",$string);
 
    }
    
    
    $myvardelete = substr($txtUrl, 0, (stripos($txtUrl, "=")+2));
    $txtUrl = str_replace($myvardelete, '', $txtUrl);
    //alert($txtUrl);
 
 


$email_to = "WKFS-InfoDevSupport@wolterskluwer.com";

// Subject
$subjectprepend = "Documentation feedback - ";
$email_subject = $subjectprepend . ' ' . $product;
$email = $_POST['email'] ; 
$message = $_POST['company'] ;     
 
// create email headers
 
$headers = 'From: '.$email_from."\r\n".
$headers .= 'Reply-To: '.$email_from."\r\n" .
$headers .= 'X-Mailer: PHP/' . phpversion();
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
 
@mail($email_to, $email, $message, $headers);  
 
?>
 
 
 
<!-- include your own success html here -->
 

<div style="font-family:'Segoe UI', 'Segoe UI Light', Helvetica, Garuda, Arial, sans-serif; margin:0 auto; margin-top:50px; width: 500px"> 
    <h2 style="color:rgb(110, 187, 31); font-family:'Segoe UI Light'">Thank you for contacting us.</h2>
    <p>We value our customers and your opinion.</p>
    <p>If you asked to be contacted regarding your submission, we will be in touch with you soon.</p>
    <p>Please close this window to return to your session.</p>
    
    <button type="button" 
            onclick="window.open('', '_self', ''); window.close();">Close</button>
 
</div>

 
<?php
 
}
 
?>