« See all FAQs for Emotion - Responsive HTML5/CSS3 Template

How to add additional field in Contact form?

If you need to add additional field (phone field for example) to your Contact form you need to make next steps:

  1. Open contacts.html and find form markup (line 213) then add markup for additional input after some existing field.

    <div class="field">
        <label for="email">Email:</label>
        <input type="email" name="email" id="email">
  2. Then you need to open sendMail.php and define new variable called $phone after existing variables (line 7)
    $phone = $_POST['phone'];
  3. Then replace this code on line 34
    $mail->Body = $comments;
    to this one
    $mail->Body = "Phone ".$phone."\r\n"; 
    $mail->Body .= $comments."\r\n";

    As you can see you just concatenate new field (Phone) with existing Comments.

  4. And the last thing you need to open js/jquery.form.js and define variable by inserting code after 15 line

    var phone = $('input#phone').val();

    and add this variable in ajax result. You should see next code:

    data: 'name=' + name + '&email=' + email + '&subject=' + subject + '&phone=' + phone + '&comments=' + comments,