Retrieve a field value and use in php

Hi,
i need to retrieve the value of a field and use it in php
I used gform_after_submission to call the php function but i’d need to know how to assign a value to a var from a field in gravity forms.
I’d prefer to use a parameter name assigned to the field

The gform_after_submission hook is passed the $entry array which contains the submitted values. That array uses the field or input IDs as the keys to the values.

So if you have a text field with an ID of 1 you would access the value like so:

$value = rgar( $entry, 1 );

If you have a multi-input type field, such as name, with the ID 2, you would access each input separately e.g.

$first_name = rgar( $entry, '2.3' );
$last_name = rgar( $entry, '2.6' );

See the documentation for more details about the $entry:

Ok it works like this.
Is there any way to use parameter name instead of the field ID?

There’s no built-in way to do that, the entry only uses the field or input IDs as the key to the values.

ok thank you… about the gform_after_submission
can I use it just for a specific form?

i actually used this code but i’m scared it applyed to all forms

add_action( 'gform_after_submission', 'custom_action_after_apc', 10, 2 );
function custom_action_after_apc( $entry, $form )

Yes, the usage section of the documentation indicates that hook supports appending the form id to the hook name to limit the function to a specific form: gform_after_submission - Gravity Forms Documentation