1

I have a custom webform confirmation page where I am print the submission values using the following:

<?php print $submission->data[67][0]; ?>

How can I print the title of the form field for the above data?

2

The Webform submission object's data parameter is a keyed array of component ID's/component submission data. The object doesn't contain the component field name so you'll need to reference its value through data attached on the node.

For example:

$webform_node = node_load($submission->nid);
foreach ($submission->data as $cid => $data) {
  print $webform_node->webform['components'][$cid]['name'] . ':' . $submission->data[$cid][0];
}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.