Contact form 7 set field value with get request

[text* your-name default:get] The field will obtain its default value from the GET variable with the same name (“your-name”). Try this by accessing the URL of the page of the form with an additional query string:

http://example.com/contact/?your-name=John+Smith

But what if you have two or more default options in a single form-tag? Let’s consider this form-tag’s case:

[text* your-name default:get default:post_meta "Your Name"]


You can initially in the form field set a unique text, and then use the hook to replace it with the desired value. And then no plugin will be needed.

Example. In form code:

<p>Phone<br />
[text phone "PHONE_VALUE"] </p>

in functions.php:

add_filter( 'wpcf7_form_elements', function( $form ) {
  $form = str_replace( 'PHONE_VALUE', $_GET['phone'], $form );
  return $form;
} );

in URL:

example.com/page?phone=111111

I just installed the plugin you linked and tested it. The plugin isn't meant to pull in a GET variable for a field within Contact Form 7. The plugin will do two things

  1. It will grab the $_GET variable and create a hidden field with it.
  2. It will show the variable on the page (just as text, not in a field)

The shortcode that you have in your example is for use by this http://wordpress.org/plugins/contact-form-7-dynamic-text-extension/ plugin. I downloaded and tested that plugin as well, and it seems to work just fine.

Here is the page I created the example on. http://jtwebb.com/stackoverflow-question/?someemail=asdf if you want to take a look to see it is working with the dynamic-text-extension plugin.

UPDATE: This is my contact form 7 code:

<p>Your Name (required)<br />
    [text* your-name] </p>

<p>[showparam someemail] <-- this is the shortcode of show param, just text no field</p>

<p>[getparam someemail] If you inspect this you'll see a hidden get field with the value of 'someemail' in it.</p>

<p>Your Email (required)<br />
    [dynamictext* dynamictext-380 "CF7_GET key='someemail'"]<br>This field was created with <a href="http://wordpress.org/plugins/contact-form-7-dynamic-text-extension/">http://wordpress.org/plugins/contact-form-7-dynamic-text-extension/</a></p>

<p>Subject<br />
    [text your-subject] </p>

<p>Your Message<br />
    [textarea your-message] </p>

<p>[submit "Send"]</p>