Onsite Training Enquiry

// Enrolment Form ======================================================== $msg=''; if (isset($_POST['mode']) && $_POST['mode']=='submit') { // VALIDATE REQUIRED FIELDS $valid = TRUE; $msg = "

\n
Error

\n\n You enquiry could not be sent. Please fix the following errors.

\n\n"; // Check Name if (empty($_POST['name'])) { $valid = FALSE; $msg .= "Please provide your Name.

\n\n"; } // Check Phone if (empty($_POST['phone'])) { $valid = FALSE; $msg .= "Please provide your Phone Number.

\n\n"; } // Check Email if (!empty($_POST['email'])) { if(!preg_match("/^[[:alnum:]][a-zA-Z0-9_.-]*@[a-zA-Z0-9_.-]+\.[a-z]{2,4}$/i", stripslashes(trim($_POST['email'])))) { $valid = FALSE; $msg .= "Email is in a wrong format.

\n\n"; } } else { $valid = FALSE; $msg .= "Please provide your Email Address.

\n\n"; } // Check reCAPTCHA require_once('recaptcha/autoload.php'); $siteKey = '6Lfs3SgUAAAAAI3mnrZEtSmHYRBuET7r6l3UPV3K'; $secret = '6Lfs3SgUAAAAAOFvthDbYpBCfVofA_C7bu-mYIby'; $lang = 'en'; $recaptcha = new \ReCaptcha\ReCaptcha($secret); $resp = $recaptcha->verify($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']); if ($resp->isSuccess()) { // all good; } else { $valid=false; foreach ($resp->getErrorCodes() as $code) { $msg .= 'There was a problem with your reCAPTCHA security test. Please try again.'; } } $msg .= "
\n

\n\n"; if ($valid) { $msg = ""; } //END VALIDATE } if(isset($valid) && $valid) { // mail request $msgtxt = "Name : " . $_POST['name'] . "\n"; $msgtxt.= "Company : " . $_POST['company'] . "\n"; $msgtxt.= "Contact Method : " . $_POST['contact_method'] . "\n"; $msgtxt.= "Phone : " . $_POST['phone'] . "\n"; $msgtxt.= "Email : " . $_POST['email'] . "\n"; $msgtxt.= "Comments : " . $_POST['comments'] . "\n"; $to = 'bookings@testandtagtraining.co.nz, bookings@testandtagtraining.com.au, joshgross1@hotmail.com'; // $to = 'dmitry@prointernet.com.au'; $subject = 'Test & Tag Training NZ - Onsite Training Enquiry'; $headers = 'From: '. $_POST['email'] . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $msgtxt = wordwrap($msgtxt, 70); $msgtxt = stripslashes($msgtxt); if(mail($to, $subject, $msgtxt, $headers)) { ob_end_clean(); header("Location: enrol-thank-you"); exit; } else { echo "

\n Email could not be sent. Please contact us on 1300 848 302

\n\n

\n"; } } else { echo $msg."\n\n"; echo '


'; } echo '

For bookings over the phone or for more information please call 1300 848 302

';