Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get gravity forms input values

How do i get the values of specific input elements inside the gform_after_submission hook in Gravity Forms? I can get the labels with

foreach($form['fields'] as $k=>$v)
{
    $label=$form['fields'][$k]['label'];
}

but how do I get the values?

like image 930
Yamiko Avatar asked May 08 '26 14:05

Yamiko


1 Answers

Following the Gravity guidelines you set up the hook to call your own function - in the case below the function is after_submission().

You can access the input values of individual form elements using their IDs like so;

add_action("gform_after_submission", "after_submission", 10, 2);

function after_submission($entry, $form){

    $name = $entry["2"];
    $address = $entry["17"] . ', '. $entry["18"] .', '. $entry["19"];

}

The IDs are all there in the form fields title in the backend, just hover over each one and it'll give you the type and ID (ie 'Single Line Text: Field ID 2).

http://www.gravityhelp.com/documentation/page/Gform_after_submission

like image 80
McNab Avatar answered May 10 '26 04:05

McNab



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!