0

I am using webform 2 pdf module, where I am trying to set up a custom content to the pdf file.

I would like to acces the webform submission data, but I have no idea how to do it. Basically I would like to access them and use them as tokens.

I am on a basic level with both drupal and php, which means I have limits.

//simple first section    
<h1 align="center" style="font-family:verdana;" style="font-size:14;"><b>Registration<b></h1><br>

<p style="text-align:left; font-family:verdana; font-size:12;" ><b>1. Registered Data:</b></p>
<p style="text-align:left; font-family:verdana; font-weight: normal; font-size:12;" >[submission:values:personal_info:key]</p>

<p style="text-align:left; font-family:verdana; font-size:12;" ><b>2.  Declaration:</b></p>
// there comes the non-working php part
<p><?php 
    $var=($fields["institutuonal info"]);
    if ($var == "spec_inst") {
      echo "some juristic stuff";
    }
    ?></p>

So I am trying to export webform submission results to PDF, but the result depends on the submission content.

4
  • So, you are trying to export webform submission results to PDF?
    – AjitS
    Commented Oct 12, 2018 at 15:34
  • Yes, but the result depends on the submission content.
    – buboreka
    Commented Oct 12, 2018 at 15:35
  • Can you edit the question and elaborate on the dependency part?
    – AjitS
    Commented Oct 12, 2018 at 15:41
  • Of course, I did
    – buboreka
    Commented Oct 13, 2018 at 6:59

1 Answer 1

0

So I partly was able to access webform values. I still have a problem, that I cannot access to one single submission, altough I tried $sid = GET[sid] method. So here is my partly good code:

    //simple first section    
<h1 align="center" style="font-family:verdana;" style="font-size:14;"><b>Registration<b></h1><br>

<p style="text-align:left; font-family:verdana; font-size:12;" ><b>1. Registered Data:</b></p>
<p style="text-align:left; font-family:verdana; font-weight: normal; font-size:12;" >[submission:values:personal_info:key]</p>

<p style="text-align:left; font-family:verdana; font-size:12;" ><b>2.  Declaration:</b></p>


<?php
$submissions = webform_get_submissions(array('nid'=>1));
foreach ($submissions as $submission){
foreach ($submission->data as $row=>$data){
        if ($row == 4){
              if (in_array("0", $data)) {
                    print("long boring text content");
}}}}
?>

So still not what I wanted but that is another question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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