Body: <p>I'm trying to work with the Sprout Forms events to grab a variable from the form and add it to a filename also uploaded through the same form.  I am extremely stuck and so far I can't even confirm that the event itself is working.  What I need to do is grab the variables from the form on the event after save.  To start, how do I print the variables in the event?  Do I need to do a second function?</p>
  <pre><code>Event::on(Entry::class, Entry::EVENT_AFTER_SAVE, function(Event $event) {
          $formEntry = $event-&gt;sender;
          $fieldHandle = $formEntry-&gt;getRequiredParam('fieldHandle');
          print $fieldHandle;
      });
  </code></pre>
  <p>Also, dumb question, do events need to be inside of a Controller?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-07-12T00:26:31.610Z
Comments.Text: You want to print it out to see if your event is being hit? You can use `die($fieldHandle);` and that'll halt the rest of the request while outputting the value. https://www.php.net/manual/en/function.die.php
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-07-13T12:08:40.270Z
Comments.Text: Make sure the 'Entry' variable in your code refers to the Sprout Forms Entry Element and not the Craft Entry Element. Sometimes an editor can autocomplete the wrong reference there: `use barrelstrength\sproutforms\elements\Entry`. And, as die works like Brad described, if you need a look at the whole event, Craft provides a statement that can output the whole event object `\Craft::dd($event);`
Comments.UserDisplayName: Ben Parizek
Tags: <craft3><php><plugin-sproutforms>
Title: How to print variables inside a PHP Event?
ThreadText: # How to print variables inside a PHP Event?
  
  (Asked by: username_0 on 2021-07-10)
  
  I'm trying to work with the Sprout Forms events to grab a variable from the form and add it to a filename also uploaded through the same form. I am extremely stuck and so far I can't even confirm that the event itself is working. What I need to do is grab the variables from the form on the event after save. To start, how do I print the variables in the event? Do I need to do a second function?
  
  ```
  Event::on(Entry::class, Entry::EVENT_AFTER_SAVE, function(Event $event) {
          $formEntry = $event->sender;
          $fieldHandle = $formEntry->getRequiredParam('fieldHandle');
          print $fieldHandle;
      });
  
  ```
  
  Also, dumb question, do events need to be inside of a Controller?
  
  **Tags:** craft3, php, plugin-sproutforms
  
  > **Comments:**
  > **username_1**: You want to print it out to see if your event is being hit? You can use `die($fieldHandle);` and that'll halt the rest of the request while outputting the value. https://www.php.net/manual/en/function.die.php  
  > **username_2**: Make sure the 'Entry' variable in your code refers to the Sprout Forms Entry Element and not the Craft Entry Element. Sometimes an editor can autocomplete the wrong reference there: `use barrelstrength\sproutforms\elements\Entry`. And, as die works like username_1 described, if you need a look at the whole event, Craft provides a statement that can output the whole event object `\Craft::dd($event);`  
  
  ---
  
  ## 0 answers
  
  