session_start(); $email_notify = 'office@tgpowersports.com'; ?>
Our Goal is Simple:
|
|
||||||||||
$reenter = true; $flds = array( 'name' => array('type' => 'edit', 'caption' => 'Name', 'required' => true, 'data_type' => 'string', ), 'phone' => array('type' => 'edit', 'caption' => 'Phone Number', 'required' => true, 'data_type' => 'string', ), 'email' => array('type' => 'edit', 'caption' => 'Email Address', 'required' => true, 'data_type' => 'string', ), 'comments' => array('type' => 'edit', 'caption' => 'Comment/Question', 'required' => true, 'data_type' => 'string', ), 'captcha' => array('type' => 'edit', 'caption' => 'Enter the Answer', 'required' => true, 'data_type' => 'string', //'default_value' => // get_setting('sms_one_time')), ) ); $errors = array('captcha' => ''); if (isset($_POST['post'])) { $valid = true; //print " "; print_r($_POST); print ""; //print " "; print_r($_SESSION); print ""; if(!isset($_POST['email'])) { $errors['captcha'] = 'Please enter a email.'; $valid = false; } else { $userEmail = $_POST['email']; } if (!isset($_SESSION['img_number'])) { $errors['captcha'] = 'Please enter the answer again'; $valid = false; } else { if (!isset($_POST['captcha'])) { $errors['captcha'] = 'Please enter the answer'; $valid = false; } else { if ($_POST['captcha'] != $_SESSION['img_number']) { $errors['captcha'] = "Previous answer incorrect ($_POST[captcha] instead $_SESSION[img_number] = $_SESSION[img_n1] + $_SESSION[img_n2]). Please enter again"; $valid = false; } } } if ($valid) { $reenter = false; // process form $email_msg = ""; $email_msg .=""; foreach($flds as $k => $fld) { if ($k != 'captcha' && $k != 'email_confirm') { $v = (isset($_POST[$k])) ? $_POST[$k] : ''; $email_msg .= "$fld[caption]: $v "; } } $email_headers = ''; $email_headers .= 'MIME-Version: 1.0' . "\r\n"; $email_headers .= 'From: office@tgpowersports.com'. "\r\n"; $email_headers = "Reply-to: $userEmail" ."\r\n"; $email_headers .= 'Content-type: text/html; charset=iso-8859-1'."\r\n"; $email_subj = "New Contact at TG Powersports.com"; mail($email_notify, $email_subj, $email_msg, $email_headers); // thank you print "
|