Witajcie!
Mam problem z kodem forularza który zamieszczam poniżej. Po edycji tego kodu - dodanie pola Data wszystko się posypało i wykrzaczyło mi Wordpressa ;/ Czy macie może pomysł jaki zrobiłem błąd? ;/ Wiem, że tek konkretny plik powoduje problem z WP.
Z góry dziękuje za pomoc,
Pozdrawiam
Formularz:
<?php
/*
* Contact Form
* Inspired by <a href="http://trevordavis.net/blog/wordpress-jquery-contact-form-without-a-plugin" target="_blank">http://trevordavis.net/blog/wordpress-jque...ithout-a-plugin</a>
*/
$nameError='';
$dataError='':
$emailError='';
$commentError='';
$captchaError='';
//If the form is submitted
if(isset($_POST['submitted'])) { //Check to make sure that the name field is not empty
if(trim($_POST['contactName']) === '') { $nameError = __('Zapomniano wprowadzić Imienia i Nazwiska','SimpleKey');
$hasError = true;
} else {
$name = trim($_POST['contactName']); }
if(trim($_POST['data']) === '') { $dataError = __('Zapomniano wprowadzić daty','SimpleKey');
$hasError = true;
} else {
$data = trim($_POST['data']); }
//Check to make sure sure that a valid email address is submitted
if(trim($_POST['email']) === '') { $emailError = __('Brak adresu E-mail','SimpleKey');
$hasError = true;
} else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['email']))) { $emailError = __('E-mail nieprawidłowy','SimpleKey');
$hasError = true;
} else {
$email = trim($_POST['email']); }
//Check to make sure comments were entered
if(trim($_POST['comments']) === '') { $commentError = __('Brak treści wiadomości','SimpleKey');
$hasError = true;
} else {
if(function_exists('stripslashes')) {
} else {
$comments = trim($_POST['comments']); }
}
//Check Captcha
if(isset($VAN['enable_captcha']) && $VAN['enable_captcha']==1
){ if(trim($_POST['captcha']) === '') { $captchaError = __('Wpisz ciąg z obrazka.','SimpleKey');
$hasError = true;
} else {
if($_POST['captcha']!==$_SESSION['van_captcha']) {
$captchaError = __('Przepisany kod jest błędny.','SimpleKey');
$hasError = true;
}
}
}
//If there is no error, send the email
$emailTo = $VAN['email'];
$subject = get_bloginfo('name').' Nowa wiadomość ze strony www '.$name;
$body = "Imię: $name \n\nEmail: $email \n\nData: $data \n\nComments: $comments";
$headers = 'Od: '.$name.' <'.$email.'>' . "\r\n" . 'Odpowiedz do: ' . $email;
wp_mail($emailTo, $subject, $body, $data, $headers);
$emailSent = true;
}
} ?>
<div class="contactform">
<?php if(isset($emailSent) && $emailSent == true) { ?> <span class="success"><?php _e('Dziękuje :) E-mail został wysłany. Odpowiem najszybciej jak to możliwe.','SimpleKey');?></span>
<?php }else{ ?>
<?php if($nameError !== ''){?>
<span class="error">
<?php echo $nameError;?></span>
<?php } if($emailError !== ''){?>
<span class="error">
<?php echo $emailError;?></span>
<?php if($dataError !== ''){?>
<span class="error">
<?php echo $dataError;?></span>
<?php }if($commentError !== ''){?>
<span class="error">
<?php echo $commentError;?></span>
<?php }if($captchaError !== ''){?>
<span class="error">
<?php echo $captchaError;?></span>
<?php }?>
<form id="contactForm" method="post" action="?">
<label><input type="text" name="contactName" id="contactName" class="requiredField" value="
<?php if(isset($_POST['contactName'])) echo $_POST['contactName'];?>" placeholder="
<?php _e
('Imię i nazwisko','SimpleKey','SimpleKey');?>" /></label>
<label><input type="text" name="email" id="email" value="
<?php if(isset($_POST['email'])) echo $_POST['email'];?>" class="requiredField email" placeholder="
<?php _e
('Email','SimpleKey','SimpleKey');?>" /></label>
<label><input type="text" name="data" id="data" class="requiredField" value="
<?php if(isset($_POST['data'])) echo $_POST['data'];?>" placeholder="
<?php _e
('Data wesela/imprezy - dd/mm/rrrr','SimpleKey','SimpleKey');?>" /></label>
<label><textarea class="requiredField" name="comments" id="comments" placeholder="<?php _e('Treść wiadomości','SimpleKey');?>"><?php
if(isset($_POST['comments'])) { if(function_exists('stripslashes')) {
} else {
}
}
?></textarea></label>
<?php if(isset($VAN['enable_captcha']) && $VAN['enable_captcha']==1):?> <div class="cp">
<input type="text" name="captcha" id="captcha" value="" class="requiredField captcha" placeholder="
<?php _e
('Przepisz kod','SimpleKey');?>" /><a href="java script:refreshCaptcha();" class="cpt-img"><img id="mycaptcha" src="
<?php echo get_template_directory_uri
();?>/functions/captcha/van_captcha.php?rand=
<?php echo rand();?>" /></a>
</div>
<input type="hidden" name="get_captcha" id="get_captcha" value="
<?php echo $_SESSION['van_captcha'];?>" />
<?php endif;?>
<input type="hidden" name="submitted" id="submitted" value="true" />
<div class="clearfix"></div>
<button type="submit" name="submit" id="submitMsg" class="large_btn contact-btn"><?php _e('Wyślij','SimpleKey');?></button>
</form>
<?php }?>
<script type="text/javascript">
//Ajax feedback message
var forgot_error='<?php _e('Zapomniano wpisać','SimpleKey');?>';
var email_error='<?php _e('Wprowadzono błędny','SimpleKey');?>';
var success='<?php _e('Dziękuje :) E-mail został wysłany. Odpowiem najszybciej jak to możliwe.','SimpleKey');?>';
var verify='
<?php echo get_template_directory_uri
();?>/functions/captcha/van_check.php';
function refreshCaptcha(){
var img = document.images['mycaptcha'];
img.src = img.src.substring(0,img.src.lastIndexOf("?"))+"?rand="+Math.random()*1000;
}
</scrip1t>
</div>1