//=============================================
// Get a specefic value for an entry using
// the label instead of the id of the from input
//=============================================
function get_value_by_label($key, $form, $entry) {
foreach ($form['fields'] as &$field) {
if ($field['type'] == ‘hidden’) {
$lead_key = $field['label'];
} else {
$lead_key = $field['adminLabel'];
}
if ($lead_key == $key) {
return $entry[$field['id']];
}
}
return false;
}

  • Mudassir

    Hi

    i want to use this function…can any one tell me how to use it..

    i mean where i place this function?

  • Steve

    Thanks for this. Do you know a way to get the name values using form label. I have tried but can’t work it out. I know they are stored in an array but would really like to grab them with label names like First Name and Last Name. The address field is also like this.

    Could this function be modified to deal with these special fields ?. Also to get it working I had to change the if field type == hidden to !=

  • http://lostdogrescue.org ben

    how do you declare the $form object you pass to the function?