Forum HTML Templates Phyon Issues with Subscribe and Contact Buttons.

You currently own this topic would you like to Unclame it?

This topic contains 7 replies, has 2 voices, and was last updated by  Labluzzaman 1 year, 11 months ago.

  • Author
    Posts
  • #5362

    mfcprofile

    Hi, first let me say that my coding experience is minimal so these may be very simple issues to resolve and I just do not have the knowledge.

    So, I can’t figure out how to get the SUBSCRIBE or CONTACT buttons to work. I see they both start with:
    <form action=”#” method=”post” id=”contactform” class=”contactform”>

    But what exactly do I replace the # with? And where do I enter my Mailchimp URL and email address? I tried comparing the code to the KITE theme, but I don’t see the references in functions.js and there are no PHP files to edit. I even tried:
    <form action=”email.php” method=”post” id=”contactform” class=”contactform”>
    and used the KITE email.php and prayed real hard, but that obviously didn’t work.

    Lastly, while testing the form, I discovered this:
    Contact Form Error

  • #5363

    Labluzzaman
    Support
    Posts: 539

    Hello,
    Here we attached a fresh copy of kite. You can replace your data into it or replace the contact & subscribe form in to your existing file, it’s on you. In this attached file your need to replace the mailchimp url in function.js file and also replace the email url in to email.php file. Hope you can solve your problem through this.

    Thanks.

  • #5364

    mfcprofile

    I’m sorry for not explaining, this is for PHYON template. I previously had KITE installed, so hoped things would be similar.

  • #5383

    mfcprofile

    Ok so I replaced the contact and subscribe forms in PHYON with the ones in KITE. I copied the code from KITE’s functions.js to PHYON’s functions.js. I also copied the PHP folder and email.php into my PHYON directory, and the jquery.ajaxchimp.min to the JS directory.

    My Subscribe issue is resolved now. The Contact issue persists.

    After doing the above and replacing the ID’s in the original PHYON code, I receive the following error: [19-Jun-2015 03:39:40 America/New_York] PHP Notice: Undefined variable: message in /home/———/public_html/email.php on line 20

    Here are my three pieces of code:
    index.html
    <form action=”email.php” method=”post” id=”contactform” class=”contactform”>
    <div class=”row”>
    <div class=”col-sm-4″>
    <input id=”first_name” class=”form-control” name=”first_name” type=”text” placeholder=”John Doe” value=”” required>
    </div>
    <div class=”col-sm-4″>
    <input id=”contact_email” class=”form-control pull-right” name=”contact_email” type=”email” placeholder=”example@example.com” value=”” required>
    </div>
    <div class=”col-sm-4″>
    <input id=”contact_subject” class=”form-control pull-right” name=”contact_subject” type=”text” placeholder=”Subject” value=”” required>
    </div>
    </div>
    <textarea id=”contact_message” class=”form-control” name=”contact_message” placeholder=”Your Message” rows=”9″ required></textarea>
    <div class=”default”>
    <button name=”reset” class=”btn btn-md btn-xs light-black” type=”reset” id=”reset”>Reset</button>
    <button name=”submit” class=”btn btn-md btn-xs light-black” type=”submit” id=”submit2″>Send</button>
    </div><!– /.default –>
    </form><!– /#contactform –>

    email.php
    <?php
    if($_REQUEST[‘first_name’] == ” || $_REQUEST[‘contact_email’] == ” || $_REQUEST[‘contact_message’] == ”):
    return “error”;
    endif;
    if (filter_var($_REQUEST[‘contact_email’], FILTER_VALIDATE_EMAIL)):
    $subject = ‘Email from kite Demo Page’; // Subject of your email

    // Receiver email address
    $to = ‘———-‘; //Change the email address by yours

    // prepare header
    $header = ‘From: ‘. $_REQUEST[‘first_name’] . ‘ <‘. $_REQUEST[‘contact_email’] .’>’. “\r\n”;
    $header .= ‘Reply-To: ‘. $_REQUEST[‘first_name’] .’ <‘. $_REQUEST[‘contact_email’] .’>’. “\r\n”;
    // $header .= ‘Cc: ‘ . ‘example@domain.com’ . “\r\n”;
    // $header .= ‘Bcc: ‘ . ‘example@domain.com’ . “\r\n”;
    $header .= ‘X-Mailer: PHP/’ . phpversion();

    $message .= ‘Name: ‘ . $_REQUEST[‘first_name’] . “\n”;
    $message .= ‘Email: ‘ . $_REQUEST[‘contact_email’] . “\n”;
    $message .= ‘Subject: ‘ . $_REQUEST[‘contact_subject’] . “\n”;
    $message .= ‘Message: ‘. $_REQUEST[‘contact_message’];

    // Send contact information
    $mail = mail( $to, $subject , $message, $header );

    echo ‘sent’;
    else:
    return “error”;
    endif;

    ?>

    functions.js
    /* Contact
    ——————————————————————-*/
    $(‘#contact-submit’).click(function () {
    $(‘.first-name-error, .contact-email-error, .contact-subject-error, .contact-message-error’).hide();
    var first_nameVal = $(‘input[name=first_name]’).val();
    var emailReg = /^(([^<>()[\]\\.,;:\s@\”]+(\.[^<>()[\]\\.,;:\s@\”]+)*)|(\”.+\”))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/igm;
    var emailVal = $(‘#contact_email’).val();
    var contact_subjectVal = $(‘input[name=contact_subject]’).val();
    var messageVal = $(‘textarea[name=contact_message]’).val();

    //validate

    if (first_nameVal == ” || first_nameVal == ‘First Name *’) {
    $(‘.first-name-error’).html(‘<i class=”fa fa-exclamation”></i> First name is required.’).fadeIn();
    return false;

    }
    if (emailVal == “” || emailVal == “Email Address *”) {

    $(‘.contact-email-error’).html(‘<i class=”fa fa-exclamation”></i> Your email address is required.’).fadeIn();
    return false;

    } else if (!emailReg.test(emailVal)) {

    $(‘.contact-email-error’).html(‘<i class=”fa fa-exclamation”></i> Invalid email address.’).fadeIn();
    return false;
    }
    if (contact_subjectVal == ” || contact_subjectVal == ‘Subject *’) {
    $(‘.contact-subject-error’).html(‘<i class=”fa fa-exclamation”></i> Subject is required.’).fadeIn();
    return false;
    }
    if (messageVal == ” || messageVal == ‘Message *’) {
    $(‘.contact-message-error’).html(‘<i class=”fa fa-exclamation”></i> Please provide a message.’).fadeIn();
    return false;
    }

    var data_string = $(‘.contact-form’).serialize();

    $(‘#contact-submit’).hide();
    $(‘#contact-loading’).fadeIn();
    $(‘.contact-error-field’).fadeOut();

    $.ajax({
    type: “POST”,
    url: “php/contact.php”,
    data: data_string,

    //success
    success: function (data) {

    $(‘.contact-box-hide’).slideUp();
    $(‘.contact-message’).html(‘<i class=”fa fa-check contact-success”></i><div>Your message has been sent.</div>’).fadeIn();
    },
    error: function (data) {

    $(‘.btn-contact-container’).hide();
    $(‘.contact-message’).html(‘<i class=”fa fa-exclamation contact-error”></i><div>Something went wrong, please try again later.</div>’).fadeIn();
    }

    }) //end ajax call
    return false;
    });

    /* Contact End
    ——————————————————————-*/

    BTW, this line is in the original PHYON code, which is the reason I was getting the error in the image above:
    <input id=”subject” class=”form-control pull-right” name=”email” type=”email” placeholder=”Subject” value=”” required>
    Obviously, it’s an easy fix, but just a heads up for your next bug fix release~

  • #5384

    Jewel Theme
    Support
    Posts: 1002

    Hello mfcprofile,
    We will release an update of Phyon Template with fixing those bugs by 2-3 days.
    Thanks

  • #5385

    mfcprofile

    And to clarify, I realize the HTML is calling on EMAIL.PHP in the root, while the JS is calling on CONTACT.PHP in the php folder; both php files are identical.

  • #5386

    mfcprofile
    This reply has been marked as private.
  • #5390

    Labluzzaman
    Support
    Posts: 539

    Hello,
    Yes we will add a script for send mail without refresh the page or go to another page.
    Thanks.

You must be logged in to reply to this topic.