How to pass on dynamic data using hidden field in Contact Form 7

Contact Form 7 is one of the most downloaded plugins in WordPress for sending out enquiry emails from your blog. Its very easy to use and allows you to setup your form with validation very quickly. If you have basic set of requirements then Contact Form 7 will do the job for you but if you have a requirement to send some dynamic data in your enquiry email then it comes up short.

Problem:

As can be seen in the picture above the plugin has all the fields which require user to enter his details and then submit the form however if you want to pass on some information which is important to you such as the page on which the user is on or his IP address etc then you will need a hidden field for the purpose. The hidden field as the name suggest is hidden from the user’s view but passes on the data with the other form fields. Unfortunately the hidden field is no present in the default set of controls that Contact Form 7 provides.

Solution:

Enter the Contact Form 7 Dynamic Text Extension plugin. The plugin cannot work on its own. It requires the Contact Form 7 plugin to work. Once you install this plugin you will see some new fields come up on the Form tab.

Now you have option to select any dynamic field and use it on your form. In this example I will be using the dynamic hidden field however you can use any other field suitable in your case. if you click on the dynamic hidden field a popup will appear as below

As you can see it provides you a lot of options to use. I will be using the current URL in my hidden field. Once I select it and move ahead I can use this field in my form as follows

I have added the field to my form and now I can add it to the email message in the Mail tab as follows

And that’s it. Now when the form is submitted the email will contain the URL of the page from which the form was submitted. This can be helpful when you have a lot of pages and you want to know from which page the form was submitted.

Hope the above helped.

Let me know if you have any comments or suggestions.