Although this entry is a bit dated, a simple yet powerful solution remains available: the Data Source for Contact Form 7 plugin. This plugin allows you to populate form fields dynamically with data from a database or other sources. For instance, if your URL includes a product ID and you wish to display the corresponding product title in a form field, you can utilize a recordset tag within your form. The recordset tag fetches the product information from the database, filtering by the "product" URL parameter, while a recordset-field-link field then populates the desired form field with the retrieved data. The hypothetical CF7 form structure would be:
<label>Post title</label>: [text title]
[cf7-recordset id="product-data" type="database" query="SELECT post_title FROM {wpdb.posts} WHERE ID={var.url.product}"]
[cf7-link-field recordset="product-data" field="title" value="post_title"]