# Pass field value form 1 to html on form 2 \[RESOLVED\]

**URL:** <https://community.gravityforms.com/t/pass-field-value-form-1-to-html-on-form-2-resolved/11341>\
**Category:** Get Help\
**Tags:** dynamic-population, whatsapp\
**Created:** [December 4, 2021, 7:32pm UTC](https://community.gravityforms.com/t/pass-field-value-form-1-to-html-on-form-2-resolved/11341 "2021-12-04T19:32:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adey](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/adey/32/4126_2.png) [@Adey](https://community.gravityforms.com/u/Adey)\
**Post date:** [December 4, 2021, 7:32pm UTC](https://community.gravityforms.com/t/pass-field-value-form-1-to-html-on-form-2-resolved/11341/1 "2021-12-04T19:32:09Z")

</div>

This may be pie in the sky.

But is it possible to pass a field value from one form to the other but inside an html field on the second form?

Whys you ask? What’s the use case?

I have a WhatsApp button on form 2 and it would be good to have the persons name on the WhatsApp click string.

Some guidance would be appreciated thanks.

---

<div class="post-metadata">

**Author:** ![user5c0166073a6c48.6](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/user5c0166073a6c48.6/32/17391_2.png) [@user5c0166073a6c48.6](https://community.gravityforms.com/u/user5c0166073a6c48.6)\
**Post date:** [December 4, 2021, 8:55pm UTC](https://community.gravityforms.com/t/pass-field-value-form-1-to-html-on-form-2-resolved/11341/2 "2021-12-04T20:55:38Z")

</div>

Disclaimer I am not a PHP expert and this is typically outside of the questions I answer but I know the community is kind of offline on weekends. I put together something for you below. If none of this works you can always look into  
[Gravity Forms Populate Anything](https://gravitywiz.com/documentation/gravity-forms-populate-anything/) or also the [URL params](https://wordpress.org/plugins/url-params/) plugin

My solution (untested)  
I’m assuming your first form is the one that gets the user’s name?

What you should do is set up a redirect confirmation on form1 to redirect to form2 and then in the ‘Pass Field Data via Query String’ field on form 1 enter name=and then select the merge tag from the merge tag dropdown which populates the name field.

Add this shortcode to your functions.php file.

```auto
add_shortcode('whatsapp_link', 'whatsapp_url_function'); 
function whatsapp_url_function( $atts ) { 
 extract( shortcode_atts( array(
 'whatsappurl' => '',
 ), $atts ) );
 
 // Get var from parameter in Gravity Forms confirmation page url
 $whatsapp_link_url = $_GET[$whatsappurl]; // this $whatsappurl word has to be the same as the word in the extract above (but without the $)
 // you can test with: return $_GET[$whatsappurl];

// Change the first part of the url to the whatsapp URL but leave the /$whatsapp_link_url variable
 if( $whatsapp_link_url != '' ) {
 return 'https://whatsappurl.com/$whatsapp_link_url'; 
 }
}

```

Lastly, on form 2 in the HTML field add the shortcode [whatsapp\_link whatsappurl=‘name’]

Shortcode snippet attribute  
[Sarah Moyer](https://sarah-moyer.com/how-to-use-query-string-in-url-to-display-content-on-the-page/)

---

<div class="post-metadata">

**Author:** ![Adey](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/adey/32/4126_2.png) [@Adey](https://community.gravityforms.com/u/Adey)\
**Post date:** [December 5, 2021, 6:46am UTC](https://community.gravityforms.com/t/pass-field-value-form-1-to-html-on-form-2-resolved/11341/3 "2021-12-05T06:46:27Z")

</div>

Thanks Derek.

The field I wish to pass from form 1 is FirstName and append it to a url string on form2 html field.

I will have a play.

---

<div class="post-metadata">

**Author:** ![Adey](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/adey/32/4126_2.png) [@Adey](https://community.gravityforms.com/u/Adey)\
**Post date:** [December 5, 2021, 7:11am UTC](https://community.gravityforms.com/t/pass-field-value-form-1-to-html-on-form-2-resolved/11341/4 "2021-12-05T07:11:45Z")

</div>

In short I cannot pass the variable to the html field. It doesn’t get passed.

Maybe one of the gravity team can shed light on it.

Thanks for the help Derek. Your time is appreciated.

---

<div class="post-metadata">

**Author:** ![Adey](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/adey/32/4126_2.png) [@Adey](https://community.gravityforms.com/u/Adey)\
**Post date:** [December 5, 2021, 7:42am UTC](https://community.gravityforms.com/t/pass-field-value-form-1-to-html-on-form-2-resolved/11341/5 "2021-12-05T07:42:29Z")

</div>

Right I drilled down through Sarahs post. The solution was in a post on stack exchange. Now when I use the shortcode below it ouputs the first name in html field. Quite a game changer for me really as ads some great flexibility for personalisation of the form.

```auto
[URLParam param='NameFirst']

```

* * *

Per the OP’s answer within their question:

> With your help and some Googling, I put together a shortcode that returns the value of any url parameter. Here it is:

```auto
//THIS IS A CUSTOM SHORTCODE TO DISPLAY A PARAMETER FROM THE URL
function URLParam( $atts ) {  
    extract( shortcode_atts( array(
        'param' => 'param',
    ), $atts ) );
    return $_GET[$param];  
}
add_shortcode('URLParam', 'URLParam'); 

```

I use the shortcode like this to get the `trip_type` from my URL:

```auto
[URLParam param='NameFirst']
```

---

<div class="post-metadata">

**Author:** ![user5c0166073a6c48.6](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/user5c0166073a6c48.6/32/17391_2.png) [@user5c0166073a6c48.6](https://community.gravityforms.com/u/user5c0166073a6c48.6)\
**Post date:** [December 5, 2021, 3:20pm UTC](https://community.gravityforms.com/t/pass-field-value-form-1-to-html-on-form-2-resolved/11341/6 "2021-12-05T15:20:26Z")

</div>

Glad you got it to work.

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [December 5, 2021, 4:41pm UTC](https://community.gravityforms.com/t/pass-field-value-form-1-to-html-on-form-2-resolved/11341/7 "2021-12-05T16:41:44Z")

</div>


