Contact form 7 set field value with get request

Meneer Venus picture Meneer Venus · Jun 5, 2014 · Viewed 54.8k times · Source

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.

Answer

mehedi101 picture mehedi101 · Jan 29, 2017

[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"]