5th Step: Configuring config.php - Summarizing configuration |
![]() ![]() ![]() |
We have configured our form, thank you page and prepared required email templates. Now in order to make final configurations we have to teach FPP how we would like our form to be processed. To do so we have to edit config.php located in Form Processor Pro installation. Files placement on web server Before that, we should place created files to the web server as we will use paths to these files in our config.php file. So, we place contact.html and thank-you.html to the web server's www public folder. Both email template files (email.txt and autoresponder.txt) we place in separate folder under www.
In our case:
Adding new form to config.php file Now we have all required files in place and we can edit our config.php Sample content for config.php
First, we have to declare new form in our configuration file. We do this by adding form name in [] brackets as a new line at the end of config.php file or just after global settings section. The form's name is the value used for previously added hidden files. In our case it's “contact_form”. [contact_form] After form's declaration we can put any form settings just after this line. Defining pages and their order Ok, now we have to declare all pages that would be used during Form Processor Pro work in a particular order of process. We use “page” setting for this purpose and set full or relative paths to these pages (relative to fpp installation path). If we would like to show thank you page just after successful submission of our one-page contact form we have to put it as second one. page = ../contact.html Setting up validations In order to set Full Name, Email and Subject fields as required we need to use “required_fields” validation rule and put all required field names here. See below: Please note that phrases in ( and ) brackets are just used in error messages instead of internal field names from HTML. Thus your error messages can be intuitive, user-friendly and you can even use language other than English! As we have already mentioned you can put validation rules as one field per line or write all in one string and separate field names by comma. required_fields = name (Full Name), email (Contact Email), subject (Subject) Will have the same effect - required form fields: name, email and subject. In order to restrict only properly formatted emails in email field we will use “email_fields” validation rule, the same way as above: email_fields = email (Contact Email) As you can see you can have more than one validation per one field - any amount, actually. But they have to be reasonable of course. For more information about possible validation rules refer to Field Validations chapter. Setting up email sending We would like to send two emails: one for us with form results and another as auto responder for submitter. We have already created these templates and we use them here with “email” action. Just like this: email = ../contact/email.txt For more information about possible actions refer to Actions chapter. That's all configurations for the config.php file according to our initial requirement to this Contact Form. After adding all of the above to our config.php we will have the following changes in it:
That's all! We have finished configuring our first form!
|