About This Ticket

Contact form not working. nendo.co.ke

by mkaigwa / August 18, 2015, 7:35 am

Email is set correctly under theme options. Help.

Staff

Hello

Perhaps you bought a theme for a long time. Now we have integrated it with the plugin contact form 7, you can download an update on the Theme Forest

I'm using version 1.2. Isn't that the latest?

How do I make sure the contact is using contact form 7 and not the settings under theme options?

Staff

First you need to install the plug-in, it comes in a package with the theme. If necessary, update it. You can read more about this in the documentation.

This plug-in is controlled by shortcode and you will need to insert it in your file contact.php on line 98

 

 

Thanks. 

Here's the code on contact.php line 98 is: 

 

<span class="error"><?php echo $nameError;?></span>

 

Where do I add the ID? (Full code below)

<?php 
$fragrance_email_admin = get_option('FR_EMAIL');
$fragrance_email_message = get_option('FR_EMAIL_MESSAGE');

$nameError = ''; $emailError = ''; $commentError = '';

$fr_first_digit = rand(1, 15);
$fr_second_digit = rand(1, 15);
$fr_sum = $fr_first_digit + $fr_second_digit;
        
?>

<?php 
//If the form is submitted
if(isset($_POST['submitted'])) {

        $sum = $fr_first_digit + $fr_second_digit;

        //Check to make sure that the name field is not empty
        if(trim($_POST['contactName']) === '') {
            $nameError = 'You forgot to enter your name.';
            $hasError = true;
        } else {
            $name = trim($_POST['contactName']);
        }
        
        //Check to make sure sure that a valid EMAIL address is submitted
        if(trim($_POST['FR_EMAIL']) === '')  {
            $emailError = 'You forgot to enter your email address.';
            $hasError = true;
        } else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['FR_EMAIL']))) {
            $emailError = 'You entered an invalid email address.';
            $hasError = true;
        } else {
            $FR_EMAIL = trim($_POST['FR_EMAIL']);
        }
            
        //Check to make sure comments were entered    
        if(trim($_POST['comments']) === '') {
            $commentError = 'You forgot to enter your comments.';
            $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 = $fragrance_email_admin;
            $subject = 'Contact Form Submission from '.$name;
            $body = "Name: $name \n\nEmail: $FR_EMAIL \n\nComments: $comments";
            $headers = 'From: Vortex Theme <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $FR_EMAIL;
            
            mail($emailTo, $subject, $body, $headers);

            $emailSent = true;

        }
} ?>

<?php if(isset($emailSent) && $emailSent == true) { ?>

    <div class="thanks">
        <h1>Thanks, <?php echo $name;?></h1>
        <p>Your mail was successfully sent. I will be in touch soon.</p>
    </div>

<?php }  ?>

        
        <?php if(isset($hasError) || isset($captchaError)) { ?>
            <p class="error">There was an error submitting the form.<p>
        <?php } ?>
        
    
            <div id="contact" class="responsive">
                <div class="sizers clearfix">
                    <div class="section_head">
                        <h3 class="section_name"><?php echo esc_html(get_option('FR_CONTACT_SECTION_NAME')); ?></h3><!--NAME OF SECTION-->
                    </div>
                </div>
                <div id="map-canvas"></div> <!-- MAP -->
                <form action="<?php echo $_SERVER["PHP_SELF"]; ?>" id="contactForm" method="post">
                    <input type="hidden" id="mapCoordLat" value="<?php echo esc_attr(get_option('FR_MAP_COORD_LAT')); ?>" />
                    <input type="hidden" id="mapCoordLng" value="<?php echo esc_attr(get_option('FR_MAP_COORD_LNG')); ?>" />
                    <input type="hidden" id="emailMessage" value="<?php echo esc_attr(get_option('FR_EMAIL_MESSAGE')); ?>" />
                        <p class="contact_page name"><input type="text" name="contactName" id="contactName" value="<?php if(isset($_POST['contactName'])) echo $_POST['contactName']; else esc_attr_e('Name','vortex'); ?>" class="requiredField" />
                            <?php if($nameError != '') { ?>
                                <span class="error"><?php echo $nameError;?></span> 
                            <?php } ?>
                        </p>
                        <p class="contact_page FR_EMAIL">
                            <input type="text" name="FR_EMAIL" id="FR_EMAIL" value="<?php if(isset($_POST['FR_EMAIL']))  echo $_POST['FR_EMAIL']; esc_attr_e('Email Address','vortex');?>" class="requiredField FR_EMAIL" />
                            <?php if($emailError != '') { ?>
                                <span class="error"><?php echo $emailError;?></span>
                            <?php } ?>
                        </p>
                        
                        <p class="clearfix"><textarea name="comments" id="contact_message" class="requiredField"><?php if(isset($_POST['comments'])) { if(function_exists('stripslashes')) { echo stripslashes($_POST['comments']); } else { echo $_POST['comments']; } } echo esc_textarea('Message','special'); ?></textarea>
                            <?php if($commentError != '') { ?>
                                <span class="error"><?php echo $commentError;?></span> 
                            <?php } ?>
                        </p>
                        <div id="contact_right">
                        <p class="clearfix">
                            <?php 
                                esc_html_e('Captcha: ','Fragrance');    
                                echo '<br/>';
                                echo esc_attr($fr_first_digit) . ' + ' . esc_attr($fr_second_digit) . ' = ';
                            ?>
                            <input type="text" name="contact_captcha" value="<?php if ( isset($_POST['contact_captcha']) ) echo esc_attr($_POST['contact_captcha']); ?>" id="contact_captcha" class="input requiredField captcha" size="2" />
                            <input type="hidden" id="captchaSum" value="<?php echo $fr_sum ?>" />
                        </p>
                    </div> <!-- #contact_right -->
                        <input type="reset" id="contact_reset" value="Reset" />
                        <input type="hidden" name="submitted" id="submitted" value="true" /><button type="submit" id="contact_submit" class="contact_submit">Send</button>
                </form>
            </div> <!-- end of #contact -->

Staff

How long have you bought theme?

Change this code to this

<div id="contact" class="responsive">
    <div class="sizers clearfix">
        <div class="section_head">
            <h3 class="section_name"><?php echo esc_html(get_option('FR_CONTACT_SECTION_NAME')); ?></h3><!--NAME OF SECTION-->
        </div>
    </div>
    <div id="map-canvas"></div> <!-- MAP -->
    <form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
        <input type="hidden" id="mapCoordLat" value="<?php echo esc_attr(get_option('FR_MAP_COORD_LAT')); ?>" />
        <input type="hidden" id="mapCoordLng" value="<?php echo esc_attr(get_option('FR_MAP_COORD_LNG')); ?>" />
        <input type="hidden" id="emailMessage" value="<?php echo esc_attr(get_option('FR_EMAIL_MESSAGE')); ?>" />
    </form>
    
    <?php echo do_shortcode('[contact-form-7 id="1837" title="Contact Us"]'); ?>
</div> <!-- end of #contact -->

 

Bought the theme last year - 14 Mar 2014

But even the latest theme downloaded from themeforest has the same code. 

I've tried the code you shared but it's affecting the look and feel of the contact form and still not working.

Can you share the full code or attachment of the contact.php file please?

Thanks

Staff

Last update has the code I sent you.
Instead shortcode that I have [contact-form-7 id="1837" title="Contact Us"], you have to insert the shortcode that you will generate a plug-in. Details how to use it you can read here

Thanks. What is the easiest way I can do to update the theme?

Staff

You can download it from Theme Forest. All settings are saved.