Some of the fields in WordPress Form Maker plugin let you add options from local or remote database tables. If you have a table containing a list of data, you can connect it to your form with just a few clicks. There is no need to create these options manually. This feature is available for Select and Multiple/Single Choice fields, as well as Payment Select, Payment Single/Multiple Choice and Shipping. The list is dynamic, i.e. when you make changes in the source database table, the selected options will be updated accordingly.
Select Options from Database feature is quite helpful, in case you have Name and Value columns in the source database table. The data under Name column will be used as the title of the field option. Whereas the data under Value column will be saved to Form Maker and will be visible on Form Maker > Submissions page.
Press From Database button to start configuring a dynamic list of options.
Connection
Form Maker lets you connect to a Local or Remote database table. If you select Remote option, you need to provide the following information to connect:
- Host
- Port
- Username
- Password
- Database.
Select a table. Choose the database table, where Name and Value will be selected from.
Select a name. Select the field of your database table, the values of which will be displayed to the submitter as the options of your Multiple/Single Choice or Select field.
Select a value. Choose the field of your database table, the values of which will be submitted to Form Maker database.
Adding a condition
You can add multiple conditions, which will run when getting the data for your field with database options. The table row will only be used in case it fulfils all (AND) or some (OR) of the specified conditions.
Where. Select the table field and provide the condition, which can be set to equal to, not equal to, larger than, smaller than and more. Afterwards, you will need to provide the condition value.
Order by
Form Maker plugin lets you configure the display ordering of the selected options. Note, that the ordering is only visible on the published form. Simply choose the field of your database table and specify the sequence, ascending (ASC) or descending (DESC).
On the form editor, your Single/Multiple Choice or Select field will only display the name of your database table. However, all selected options will be visible on the published form.