0
votes

After a webform is submitted, I redirect it to its "webform result submission page" automatically. Here all values are shown.

I want to access the values of that submission, to use them in some simple "if then" php statements.

This logic will add some text above that results page. (for example: if the submitted value of formelement_1 == 2 , then add this text "warning, formelement_1 has great value!").

Anybody some input ? Thanks

1

1 Answers

0
votes

Try like this way

<?php
  include_once(drupal_get_path('module', 'webform') .'/includes/webform.submissions.inc');
  $nid = arg(1); // need to hard-code nid if this is a custom page
  $sid = $_GET['sid'];
  $submission = webform_get_submission($nid, $sid);

  $first_name = $submission->data[1]['value'][0];
  $last_name = $submission->data[2]['value'][0];
  $thanks = $first_name . " " . $last_name;
  ?>

  <h2>Thank you <?php print $thanks ?>... Your registration has been sent.</h2>

  ?>

I hope, it will works.