<?php
if(isset($_POST['email'])) {
     
    // EDIT THE 2 LINES BELOW AS REQUIRED
    $email_to = "info@meccilect.com";
    $email_subject = "Enquiry from MecCilect.com visitor";
     
     
    function died($error) {
        // your error code can go here
        echo "We are very sorry, but there were error(s) found with the form you submitted. ";
        echo "These errors appear below.<br /><br />";
        echo $error."<br /><br />";
        echo "Please go back and fix these errors.<br /><br />";
        die();
    }
     
    // validation expected data exists
    if(!isset($_POST['first_name']) ||
        !isset($_POST['last_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.');      
    }
     
    $first_name = $_POST['first_name']; // required
    $last_name = $_POST['last_name']; // required
    $email_from = $_POST['email']; // required
    $telephone = $_POST['telephone']; // not required
    $comments = $_POST['comments']; // required
     
    $error_message = "";
    $email_exp = "^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$";
  if(!eregi($email_exp,$email_from)) {
    $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
  }
    $string_exp = "^[a-z .'-]+$";
  if(!eregi($string_exp,$first_name)) {
    $error_message .= 'The First Name you entered does not appear to be valid.<br />';
  }
  if(!eregi($string_exp,$last_name)) {
    $error_message .= 'The Last Name you entered does not appear to be valid.<br />';
  }
  if(strlen($comments) < 2) {
    $error_message .= 'The Comments you entered do not appear to be valid.<br />';
  }
  if(strlen($error_message) > 0) {
    died($error_message);
  }
    $email_message = "Enquiry from MecCilect.com visitor :\n\n";
     
    function clean_string($string) {
      $bad = array("content-type","bcc:","to:","cc:","href");
      return str_replace($bad,"",$string);
    }
     
    $email_message .= "First Name: ".clean_string($first_name)."\n";
    $email_message .= "Last Name: ".clean_string($last_name)."\n";
    $email_message .= "Email: ".clean_string($email_from)."\n";
    $email_message .= "Telephone: ".clean_string($telephone)."\n";
    $email_message .= "Comments: ".clean_string($comments)."\n";
     
     
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers); 
?>
<?php
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>MecCilect Engineering &amp; Safety Consultancy</title>
<meta name="description" content="MecCilect Engineering & Safety Consultancy" />
<meta name="keywords" content="MecCilect Engineering & Safety Consultancy" />
<link href="Scripts/meccilect_styles.css" rel="stylesheet" type="text/css" />
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td class="headerRepeat">&nbsp;</td>
          <td class="flashBanner"><script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','1000','height','407','title','MecCilect Flash Header','src','flash/Header','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','flash/Header' ); //end AC code
</script>
            <noscript>
            <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="1000" height="407" title="MecCilect Flash Header">
              <param name="movie" value="flash/Header.swf" />
              <param name="quality" value="high" />
              <embed src="flash/Header.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="1000" height="407"></embed>
            </object>
            </noscript></td>
          <td class="headerRepeat">&nbsp;</td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td>&nbsp;</td>
          <td class="contentSpace"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td  class="contactSpace"><img src="images/contactDetails_title.jpg" width="435" height="60" /></td>
                <td rowspan="3" >&nbsp;</td>
                <td class="contactSpace"><img src="images/contactForm_title.jpg" width="435" height="60" /></td>
              </tr>
              <tr>
                <td class="verSpace2"></td>
                <td class="verSpace2"></td>
              </tr>
              <tr>
                <td style="padding-left:20px" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td class="contact_title">MecCilect Sdn Bhd</td>
                            <td width="45%" valign="middle">(919096-W)</td>
                          </tr>
                        </table></td>
                    </tr>
                    <tr>
                      <td class="verSpace1"></td>
                    </tr>
                    <tr>
                      <td class="co">No. 1 - 35 Jalan Prima SG 2,<br />
                        Taman Prima Sri Gombak,<br />
                        68100 Batu Caves,<br />
                        Selangor, Malaysia.</span></td>
                    </tr>
                    <tr>
                      <td class="verSpace1"></td>
                    </tr>
                    <tr>
                      <td><p>Tel : +603 7948 5205<br />
                        Fax: +603 7955 6363<br />
                        Email : <a href="mailto:info@meccilect.com">info@meccilect.com<br /></a>
                        <a style=" margin-left:40px" href="mailto:devin.periasamy@meccilect.com">devin.periasamy@meccilect.com</a></p>
                        </td>
                        
                    </tr>
                    <tr>
                      <td height="250px">&nbsp;</td>
                    </tr>
                  </table></td>
                <td style="padding-left:10px" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td><form name="contactform" method="post" action="contact.php">
  <table width="425px">
    <tr>
      <td valign="top"><label for="first_name">First Name *</label>
      </td>
      <td valign="top"><input  type="text" name="first_name" maxlength="50" size="30">
      </td>
    </tr>
    <tr>
      <td valign="top"><label for="last_name">Last Name *</label>
      </td>
      <td valign="top"><input  type="text" name="last_name" maxlength="50" size="30">
      </td>
    </tr>
    <tr>
      <td valign="top"><label for="email">Email Address *</label>
      </td>
      <td valign="top"><input  type="text" name="email" maxlength="80" size="30">
      </td>
    </tr>
    <tr>
      <td valign="top"><label for="telephone">Telephone Number</label>
      </td>
      <td valign="top"><input  type="text" name="telephone" maxlength="30" size="30">
      </td>
    </tr>
    <tr>
      <td valign="top"><label for="comments">Enquiries*</label>
      </td>
      <td valign="top"><textarea  name="comments" maxlength="1000" cols="25" rows="6"></textarea>
      </td>
    </tr>
    <tr>
      <td colspan="2" style="padding-left:160px"><input type="submit" value="Submit"><input type="reset" name="Reset" value="Reset">
      </td>
      
    </tr>
  </table>
</form></td>
                    </tr>
                  </table></td>
              </tr>
            </table></td>
          <td>&nbsp;</td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td class="footerRepeat">&nbsp;</td>
          <td class="footerRepeatCenter"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td class="footerMenu"><a href="index.html" target="_self">Home</a> | <a href="about.html" target="_self">About</a> | <a href="services.html" target="_self">Services</a> | <a href="works.html" target="_self">Work</a> | <a href="faq.html" target="_self">FAQ</a> | <a href="contact.html" target="_self">Contact</a></td>
                <td align="right" class="footerText2">Powered by <a href="http://www.motionwavedesigns.com/" target="_blank">Motion Wave Designs</a>.</td>
              </tr>
              <tr>
                <td colspan="2" class="footerText1">Copyright © 2011 by MecCilect Sdn Bhd. All Rights Reserved.</td>
              </tr>
            </table></td>
          <td class="footerRepeat">&nbsp;</td>
        </tr>
      </table></td>
  </tr>
</table>
</body>
</html>
