<?php
$contact_email = lukin_smof_data('contact_email');
$nameError ='';
$emailError ='';
$commentError = '';
//If the form is submitted
if(isset($_POST['submitted'])) {
//Check to see if the honeypot captcha field was filled in
if(trim($_POST['checking']) !== '') {
$captchaError = true;
} else {
//Check to make sure that the name field is not empty
if(trim($_POST['contactName']) === '') {
$nameError = 'Вы забыли ввести Ваше имя.';
$hasError = true;
} else {
$name = trim($_POST['contactName']);
}
if(trim($_POST['tel']) == '') {
$telError = 'Вы забыли ввести Ваш телефон.';
$hasError = true;
} else {
$tel = trim($_POST['tel']);
}
//Check to make sure sure that a valid email address is submitted
if(trim($_POST['email']) === '') {
$emailError = 'Вы забыли ввести Ваш email адрес.';
$hasError = true;
} else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['email']))) {
$emailError = 'Вы ввели некорректный email адрес.';
$hasError = true;
} else {
$email = trim($_POST['email']);
}
//Check to make sure comments were entered
if(trim($_POST['comments']) === '') {
$commentError = 'Вы забыли ввести краткое описание.';
$hasError = true;
} else {
if(function_exists('stripslashes')) {
$comments = stripslashes(trim($_POST['comments']));
} else {
$comments = trim($_POST['comments']);
}
}
//If there is no error, send the email
if(!isset($hasError)) {
$emailTo = lukin_smof_data('contact_email');
$tel = $tel;
$sendCopy = trim($_POST['sendCopy']);
$body = "Name: $name \n\nEmail: $email \n\nMessage: $comments";
$headers = 'From: Студия <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;
wp_mail($emailTo, $tel, $body, $headers);
if($sendCopy == true) {
$tel = '[Copy] Ваше представление';
$headers = 'From: '.lukin_smof_data('contact_email');
wp_mail($email, $tel, $body, $headers);
}
$emailSent = true;
}
}
}
?>
<?php
/*
Template Name: Контактная
*/
get_header();
?>
<section id="inner-headline">
<div class="container">
<div class="row">
<div class="col-lg-12">
<?php get_template_part('includes/breadcrumbs'); ?>
</div>
</div>
</div>
</section>
<section id="content" class="nopadtop">
<?php if(lukin_smof_data('map_enable') != 0) { ?>
<div id="googlemaps" class="google-map">
</div>
<?php } ?>
<div class="container">
<div class="row">
<div class="col-lg-12">
<h4><?php echo __('СВЯЖИТЕСЬ С НАМИ, ЗАПОЛНИВ','lukin'); ?> <strong><?php echo __(' ФОРМУ ЗАЯВКИ','lukin'); ?></strong></h4>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" id="contactform" method="post" class="validateform">
<div class="row">
<div class="col-lg-4 field">
<input type="text" class="requiredField" name="contactName" id="contactName" placeholder="* <?php echo __('Введите Ваше имя','lukin'); ?>" data-rule="maxlen:4" data-msg="<?php echo __('Пожалуйста, введите минимум 4 символа','lukin'); ?>" />
<div class="validation">
</div>
</div>
<div class="col-lg-4 field">
<input type="text" class="requiredField" name="email" id="email" placeholder="* <?php echo __('Введите Ваш email адрес','lukin'); ?>" data-rule="email" data-msg="<?php echo __('Пожалуйста, введите настоящий адрес','lukin'); ?>" />
<div class="validation">
</div>
</div>
<div class="col-lg-4 field">
<input type="text" class="requiredField" name="tel" id="tel" placeholder="* <?php echo __('Введите Ваш номер телефона','lukin'); ?>" data-rule="maxlen:4" data-msg="<?php echo __('Пожалуйста, введите настоящий номер','lukin'); ?>" />
<div class="validation">
</div>
</div>
<div class="col-lg-12 margintop10 field">
<textarea rows="12" name="comments" class="requiredField" id="comments" class="input-block-level" placeholder="* <?php echo __('Кратко опишите задачу','lukin'); ?>..." data-rule="required" data-msg="<?php echo __('Пожалуйста, введите что-нибудь','lukin'); ?>"></textarea>
<div class="validation clearfix">
</div>
</div>
<div class="col-lg-12 field">
<p>
<button name="Mysubmitted" id="Mysubmitted" class="btn btn-theme margintop20 pull-left" type="submit"><?php echo __('ОТПРАВИТЬ','lukin'); ?></button>
<span class="pull-right margintop20">* <?php echo __('ПОЖАЛУЙСТА, ЗАПОЛНИТЕ ВСЕ НЕОБХОДИМЫЕ ПОЛЯ ФОРМЫ','lukin'); ?>!</span>
</p>
<input type="hidden" name="submitted" id="submitted" value="true" />
<input type="hidden" name="contact_success" id="contact_success" value="<?php echo lukin_smof_data('contact_success');?>" />
</div>
</div>
</form>
</div>
</div>
</div>
</section>
<?php
get_template_part('includes/contact-function');
?>
<?php get_footer(); ?>
В чем может быть проблема? Пожалуйста, помогите, сайт на WordPress.