I want to set a field value with get request
example.com/subscribe/?email=asfafs
but when i load the page which has the form on it, the form does not show. I get why it could not be showing. Because the form itself could submit a get request as well. I also installed this plugin which should enable me to set a field value, but it does not.
this is what i have:
<p>Uw naam (verplicht)<br /> [text* input-name] </p> <p>Uw email (verplicht)<br /> [dynamictext dynamicname "CF7_GET key='email'"] </p> <p>Onderwerp<br /> [text your-subject] </p> <p>Uw bericht<br /> [textarea your-message] </p> <p>[submit "Verzenden"]</p>
In my page:
<?php echo do_shortcode('[contact-form-7 id="1062" title="Contactformulier 1"]'); ?>
I wouldn’t mind using a different plugin for this. If there is one which suits my needs please tell me.
Advertisement
Answer
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
- It will grab the $_GET variable and create a hidden field with it.
- 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>