How to Collect Contact Form Data in WordPress
Most WordPress contact form plugins send a notification email to you after a form is submitted. While this is helpful, you might wonder where the data goes after that point. You may also want to know if it is possible to save this information to your WordPress database.
It is possible to do that, but there are some things you’ll need to know beforehand. There are also certain steps you can take in order to start saving form data in the correct place. Once that’s done, you can manage all of your form entries from your WordPress dashboard.
In this article, we’ll look at where the WordPress database is and how you can access it. We’ll then discuss how to collect, store, and manage contact form data in that database. Let’s get started!
Where Is the WordPress Database Stored and How Can I Access It?
When you first install WordPress, a database is automatically created. Each time new data is entered on your website, it is stored in there. The information for this database, including the host and password data, is stored in the site’s wp-config.php file.
To access the database, you need to use the PHPMyAdmin tool provided by your web host. If you have a plan here at WP Engine, for example, you can log in to your account and navigate to Environments > PHPMyAdmin.
There, you can select the website database you want to access:
Clicking on the name of your website opens its database directory. Every database table related to your website is listed, and you can select the ones you want to modify.
How to Manage and Store Entry Data in the WordPress Database
Knowing how to access your WordPress database is important, but how do you manage and store data in it? If you are using a contact form plugin such as WPForms, a dedicated database table will be created when the plugin is activated. In fact, WPForms generates two tables, wp_wpforms_entries and wp_wpforms_entry_meta, where form data is stored.
When forms are submitted via the plugin, their field data is stored in the first table. Additional data, such as associated IDs and dates, are stored in the second table. This occurs automatically. Many other form plugins provide similar systems.
To manage all of this form data, these plugins generally add a user-friendly interface to your WordPress dashboard. When it comes to WPForms specifically, you can access this via WPForms > Entries.
You can also manage these entries in your WordPress database directly. Navigate to PHPMyAdmin and click on your website’s database. Then select wp_wpforms_entries to view all contact form entries.
The database lists the form ID, user ID, and data in each form field. The field data is stored in a single cell within the table:
It is generally best to use this dashboard interface to manage your contact form data. The options you have access to will vary depending on the plugin, but you are usually able to export, print, and delete the data.
How to Collect Data from Forms
There are many reasons why you might want to collect data from forms. If you take bookings via a form, for example, this information can help you manage your calendar.
To start collecting data, you’ll need to install a form plugin and then extract the information you want. Let’s take a look at how that process works.
Step 1: Install a Plugin Like WPForms or Formidable Forms
The first step is to generate the forms themselves. While it is possible to hard code your own forms, plugins such as WPForms and Formidable Forms make this task a lot easier. To use one of them, navigate to Plugins > Add New and search for the plugin you want:
Click on Install and Activate to add the plugin to your WordPress website.
Step 2: Create Forms
After installing the plugin, you’ll need to create at least one form for your website. If you are using WPForms, navigate to WPForms > Add New:
You can use one of the templates or start with a blank page. The templates have some fields included already, although you can change them as needed. If you choose a blank form, you’ll need to manually drag-and-drop in the fields you want.
When you add a field to the form, click on it to update its options. This includes the name of the field, its description, and whether users will be required to fill it in.
Once you have all the fields you want, click on Save. You can then embed the form on your website and start collecting data.
Step 3: Locate Entries You Want to Extract
Once a few visitors have filled in your form, you can start locating and extracting the data you need. All responses will be located in the Entries section of your WordPress dashboard:
You can select the entries you want to extract from this list. Next, click on the drop-down menu under Bulk Actions, and select the option to export entries in a CSV file. This will generate a file and download it to your computer.
Step 4 (Optional): Export Data from PHPMyAdmin
Using the Entries interface provided by your form plugin is the easiest way to collect and export contact form data. However, you can also export this data from the WordPress database using PHPMyAdmin.
First, you’ll need to log into your hosting account and navigate to PHPMyAdmin. Locate your website’s database and your form entries, as discussed earlier. Click on the form table to view the entries, and select Export:
On the next page, change the Format to CSV for MS Excel to download a CSV file of all the entries. You can choose a Quick or Custom export based on the data you want to collect.
After adjusting the settings, click on Go and your CSV file will generate and download. You can then use Microsoft Excel to manage your exported data.
Optimize Your Site to the Fullest With WP Engine
Collecting and managing contact form data is a simple task as long as you have the right contact form plugin. From your dashboard, you’ll be able to view and export the data you want to collect.
Of course, your hosting provider for your WordPress site should also provide you with the resources you need to create an incredible digital experience. Here at WP Engine, we’ll help you get your site up and running quickly!