Şimdi Ara

Contact FORM

Daha Fazla
Bu Konudaki Kullanıcılar: Daha Az
3 Misafir - 3 Masaüstü
5 sn
6
Cevap
0
Favori
385
Tıklama
Daha Fazla
İstatistik
  • Konu İstatistikleri Yükleniyor
0 oy
Öne Çıkar
Sayfa: 1
Giriş
Mesaj
  • iyi günler arkadaşlar altta belirtmiş olduğum kodlar benim üzerinde çalıştığım bir temaya ait bu contact form da isim email ve mesaj bölmesi var ben araya birde motor modeli eklemek istiyordum ve ekledim fakat gönder'e bastığım zaman mesajda isim email ve mesaj bölmesi dolu motor bölmesi boş geliyor.

    yardımlarınızı bekliyorum.

    <?php 
    /*
    * Contact Form
    */
    session_start();
    global $VAN;
    $nameError='';
    $motorError='';
    $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 = __('Lütfen Adınızı belirtiniz.','SimpleKey');
    $hasError = true;
    } else {
    $name = trim($_POST['contactName']);
    }

    //Check to make sure that the motor field is not empty
    if(trim($_POST['motor']) === '') {
    $motorError = __('Lütfen motor modelinizi belirtiniz.','SimpleKey');
    $hasError = true;
    } else {
    $motor = trim($_POST['motor']);
    }

    //Check to make sure sure that a valid email address is submitted
    if(trim($_POST['email']) === '') {
    $emailError = __('You entered an invalid email address.','SimpleKey');
    $hasError = true;
    } else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['email']))) {
    $emailError = __('Size ulaşabilmek için geçerli bir mail adresi belirtiniz.','SimpleKey');
    $hasError = true;
    } else {
    $email = trim($_POST['email']);
    }

    //Check to make sure comments were entered
    if(trim($_POST['comments']) === '') {
    $commentError = __('You forgot to enter your comments.','SimpleKey');
    $hasError = true;
    } else {
    if(function_exists('stripslashes')) {
    $comments = stripslashes(trim($_POST['comments']));
    } else {
    $comments = trim($_POST['comments']);
    }
    }

    //Check Captcha
    if(isset($VAN['enable_captcha']) && $VAN['enable_captcha']==1){
    if(trim($_POST['captcha']) === '') {
    $captchaError = __('You forgot to enter CAPTCHA.','SimpleKey');
    $hasError = true;
    } else {
    if($_POST['captcha']!==$_SESSION['van_captcha']) {
    $captchaError = __('You entered an invalid CAPTCHA.','SimpleKey');
    $hasError = true;
    }
    }
    }

    //If there is no error, send the email
    if(!isset($hasError)) {
    $emailTo = $VAN['email'];
    $subject = get_bloginfo('name').' Sitesinden mesajı var '.$name;
    $body = "İsim: $name \n\nMotor Modeli: $motorName \n\nEmail: $email \n\nMesaj: $comments";
    $headers = 'From: '.$name.' <'.$email.'>' . "\r\n" . 'Reply-To: ' . $email;

    wp_mail($emailTo, $subject, $body, $headers);
    $emailSent = true;

    }
    } ?>

    <div class="contactform">
    <?php if(isset($emailSent) && $emailSent == true) { ?>

    <?php }else{ ?>
    <?php if($nameError !== ''){?>
    <span class="error"><?php echo $nameError;?></span>
    <?php } if($emailError !== ''){?>
    <span class="error"><?php echo $emailError;?></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('Ad Soyad','SimpleKey','SimpleKey');?>" /></label>
    <label><input type="text" name="motor" id="motor" class="requiredField" value="<?php if(isset($_POST['motor'])) echo $_POST['motor'];?>" placeholder="<?php _e('Motor Modeliniz','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 Adresiniz','SimpleKey','SimpleKey');?>" /></label>
    <label><textarea class="requiredField" name="comments" id="comments" placeholder="<?php _e('Mesajınız','SimpleKey');?>"><?php
    if(isset($_POST['comments'])) {
    if(function_exists('stripslashes')) {
    echo stripslashes($_POST['comments']);
    } else {
    echo $_POST['comments'];
    }
    }
    ?></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('Captcha','SimpleKey');?>" /><a data-test="test" rel="nofollow" style="word-wrap: break-word; text-decoration: underline;" target="_blank" onclick="return dhExternalLinkRedirect(this)" href="/ExternalLinkRedirect?module=pgdcode&messageId=96992335&url=javascript:refreshCaptcha();" class="cpt-img" data-href="javascript: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('Gönder','SimpleKey');?></button>
    </form>
    <?php }?>
    <script type="text/javascript">
    //Ajax feedback message
    var forgot_error='<?php _e('Burayı Unuttunuz!','SimpleKey');?>';
    var email_error='<?php _e('Geçerli bir e-mail adresi giriniz.','SimpleKey');?>';
    var success='<?php _e('Teşekkür Ederiz! E-posta gönderildi. En kısa süre içerisinde dönüş yapacağız.','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;
    }
    </script>
    </div>



    _____________________________




  • he bu arada altta belirttiğim kodu en alttaki kodun arasına ekleyince anasayfa beyaz oluyor.

     <?php if($motorError !== ''){?> 
    <span class="error"><?php echo $motorError;?></span>


     <div class="contactform"> 
    <?php if(isset($emailSent) && $emailSent == true) { ?>
    <span class="success"><?php _e('E-posta başarı ile gönderildi.','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($commentError !== ''){?>
    <span class="error"><?php echo $commentError;?></span>
    <?php }if($captchaError !== ''){?>
    <span class="error"><?php echo $captchaError;?></span>
    <?php }?>
    _____________________________




  • Koskoca donanımhaberde yardım edebilecek adam yokmu?
    _____________________________
  • __LaBeNs__ _ kullanıcısına yanıt
    $body = "İsim: $name \n\nMotor Modeli: $motorName \n\nEmail: $email \n\nMesaj: $comments";


    POST ile gelen veriyi atadığınız değişken ile body kısmında yazdırdığınız değişken farklı. $motorName değişkenini $motor olarak değiştirince olması lazım.

    motorError için <?php }else{ ?> kısmını kaldırıp altındaki ifleri elseif yaparsanız çalışması lazım .

     
    <div class="contactform">
    <?php if(isset($emailSent) && $emailSent == true) { ?>
    <span class="success"><?php _e('E-posta başarı ile gönderildi.','SimpleKey');?></span>
    <?php }
    elseif($nameError !== ''){?>
    <span class="error"><?php echo $nameError;?></span>
    <?php } elseif($emailError !== ''){?>
    <span class="error"><?php echo $emailError;?></span>
    <?php } elseif($commentError !== ''){?>
    <span class="error"><?php echo $commentError;?></span>
    <?php } elseif($captchaError !== ''){?>
    <span class="error"><?php echo $captchaError;?></span>
    <?php } elseif($motorError !== ''){?>
    <span class="error"><?php echo $motorError;?></span>
    <?php }?>
    _____________________________




  • mertcane M kullanıcısına yanıt
    MERTCAN motorNAME kısmını motor olarak değiştirince düzeldi



    < Bu mesaj bu kişi tarafından değiştirildi __LaBeNs__ -- 8 Eylül 2014; 23:19:49 >
    _____________________________
  • contact form internet explorer mozilla firefox 'da düzenli fakat google chrome da kasma yaratıyor bi bakabilirmisin?

    hcg.venom-tech.com
    _____________________________
  • Yapay Zeka’dan İlgili Konular
    Daha Fazla Göster
    
Sayfa: 1
- x
Bildirim
mesajınız kopyalandı (ctrl+v) yapıştırmak istediğiniz yere yapıştırabilirsiniz.