How to add extra field to the contact form

Hello,

*Note: this article for the old versions of FLATPACK (before v4.0), for the new versions of FLATPACK please check this video tutorial.

To add extra fields to your the exported page from FLATPACK builder you should follow this steps:
– Find the name and number of the section which contain the form by opening the html and read the first line, for example “pixfort_ecourse_8”.

– Open “js-files” folder then open “custom1.js”.
– Go to the proper section, for example “Submit (ecourse 8)”.
– add this line after “user_email” line:

var user_number = $('.pixfort_ecourse_8 input[name=number]').val();

* check the name of the field must be identical with the name of the input above and replace “pixfort_ecourse_8” with section’s name.
– Add this code if you want the field to be required:

if(user_email==""){
$('.pixfort_ecourse_8 input[name=email]').css('border-color','red');
proceed = false;
}

* replace “pixfort_ecourse_8” with section’s name.
– Replace the post_data line to add the number variable so it will be:

post_data = {'user_name':user_name, 'user_email':user_email, 'user_number':user_number };

– Open the folder “px_mail” then open the proper file, for example “contact_me_8.php”
– Add this code in line 34:

$user_Number = filter_var($_POST["user_number"], FILTER_SANITIZE_STRING);

– Replace line 64 with this code:

$sentMail = @mail($to_Email, $subject, 'Subscribe using flatpack form, Name: '. $user_Name .' -- Number: '. $user_Number .' -- Email: '.$user_Email , $headers);

You Number field should be working after that
Kind regards,

4 Comments

  1. John

    So I am working with your FlatPack, which I really like, by the way. I am having some trouble though as I want to back up the local storage values to a flat file system on the server. I have tried numerous ways, but am running into difficulty encoding, storing, and decoding. Any suggestions.

Leave A Comment?

Security check: *