Hello @yrhs320070
Yes, of course. wp_cf7_vdata_entry is a database table generated by the “Advanced CF7 DB” plugin. So, you can use our plugin to load its rows to fill other fields in the form.
The table has the structure:
id | cf7_id | data_id | name | value
I’ll try to describe the process with a hypothetical example. Assuming you have created a basic contact form with the default tags names like your-name
and your-email
. And you want to fill a dropdown menu by using your-name values as the choices’ texts and your-email as the choices’ values.
In this hypothetical case, the form structure would be similar to:
<label> Users List
[select users]</label>
[cf7-recordset id="cf7-vdata-entry" type="database" query="SELECT t1.value as name, t2.value as email FROM {wpdb.prefix}cf7_vdata_entry t1 INNER JOIN {wpdb.prefix}cf7_vdata_entry t2 ON (t1.data_id=t2.data_id) WHERE t1.name='your-name' AND t2.name='your-email'"]
[cf7-link-field recordset="cf7-vdata-entry" field="users" value="email" text="name"]
The query seems complex because I want to create a record with information of different rows in the wp_cf7_vdata_entry:”
SELECT t1.value as name, t2.value as email FROM {wpdb.prefix}cf7_vdata_entry t1 INNER JOIN {wpdb.prefix}cf7_vdata_entry t2 ON (t1.data_id=t2.data_id) WHERE t1.name='your-name' AND t2.name='your-email'
The use of the {wpdb.prefix}
constant avoids having to know the prefix used by your WordPress database. In addition, you can export the form to another website that uses a different table prefix, and it will continue working with no problems.
Best regards.