PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Function Call with Dynamic Population

  1. Hi,

    I'm trying to call upon a gravity form using PHP but am not quite sure how to do this when I have a field that I would like to populate with a value.

    Below is a basic idea of what I have ... but I don't know how to get the $address value into a gravity form dynamically populated field that I called address_info.

    <?php
    if (is_single() ){
    $address = "some-address-info";
    echo gravity_form(1, false, true, false, '', true);
    }
    ?>

    I read the documentation and it talks about an array but still not sure how this is supposed to be setup. Also, I'm unable to use the do_shortcode approach either since it doesn't seem to be working at all where I need it. The method above atleast generates the form. I'm try to use this code with the Genesis Framework Simple Hooks, which is why I need the method above to work and not the do_shortcode.

    Thanks in advance!

    Posted 13 years ago on Tuesday March 6, 2012 | Permalink
  2. Ok ... I got this. It was a simple typo that was doing me in as I was trying to test. Here's what I came up with. Simple.

    <?php
    if (is_single() ){
    $address = "some-address-info";
    $contactAddress = array ('parameter_name' => $address);
    echo gravity_form(1, false, true, false, $contactAddress, true);
    } ?>

    Posted 13 years ago on Tuesday March 6, 2012 | Permalink
  3. Awesome - glad you got it sorted out, thanks for letting us know and posting your solution!

    Posted 13 years ago on Tuesday March 6, 2012 | Permalink

This topic has been resolved and has been closed to new replies.