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.

How do I pick up list data after submission

  1. I have an issue here where I really need this to work. I've built custom actions and functions to pick up data and store it in a CRM after a successful form submission, but I can't figure out how to pull the data out of a list. Is it store in an array? I understand that to pull something like the first name, all LI woud need to do is do $firstname = $entry["1.3"]; and then use that... but what do I do with a dynamic list?

    My form: https://www.highperformancesummit.com/checkout-march/?id=1&n=ONE+Ticket&q=4&pr=1

    Posted 11 years ago on Thursday January 10, 2013 | Permalink
  2. Whenever faced with the question of how to get the data out of a list field, you can dump the $entry object in your gform_after_submission hook. That will show you exactly how to reference each and every field value in your form. You can use print_r($entry) or var_dump($entry) inside the function you have hooked to gform_after_submission. I usually echo "<!-- " before the print_r and " --> afterward, so the dump goes into the comments, not the screen. Then I usually submit the form from the form preview and check the source of the confirmation screen to see what got dumped.

    Be sure to remove that debugging code one you figure out how to get all your values out of the array.

    The list field values are stored as serialized data. You can use the PHP function unserialize the get those values out of the list field http://php.net/manual/en/function.unserialize.php

    Posted 11 years ago on Thursday January 10, 2013 | Permalink
  3. I've tried to do this several times with var_dump($entry); and print_r($entry);

    Here's my simple code:

    add_action('gform_after_submission_4', 'post_to_instant_customer4', 10, 2);
    function post_to_instant_customer4($entry, $form) {
    
        var_dump($entry);
        print_r($entry);
    
    }

    The ID of the form is 4 as shown on the form list. Upon submission, it simply goes straight to the confirmation message that the form submission was successful.

    Posted 11 years ago on Thursday January 10, 2013 | Permalink
  4. That is correct. This information will be dumped to the screen, but it's technically not the 'correct' way of doing it. You should be able to view the source of the confirmation page and see the arrays being dumped. It's not always displayed on-screen.

    If that does not work for you, we can always set up proper logging so you can check the log file for the array and figure out how to address your values.

    Posted 11 years ago on Friday January 11, 2013 | Permalink
  5. Ok. I'll try that. Thank you.

    Posted 11 years ago on Saturday January 12, 2013 | Permalink
  6. Let me know if you need help. You're in advanced territory here with the list field, but we can help you get the information out of the entry.

    Posted 11 years ago on Saturday January 12, 2013 | Permalink