Answers.Body: <p>If you just want to test if <em>something</em> is in POST, and don't care what it is, then this should work:</p>
  
  <pre><code>{% set success = craft.request.getPost() | length %}
  
  {% if success %}
      form was just submitted
  {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-11T23:21:44.270Z
Answers.LastActivityDate: 2014-07-11T23:21:44.270Z
Answers.UserDisplayName: Brad Bell
Answers.Body: <p>I think you want this:</p>
  
  <pre><code>{% set success = craft.request.getPost('test') %}
  {% if success %}form was just submitted{% endif %}
  </code></pre>
  
  <p>Pass a string to <code>getPost()</code></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-14T13:54:36.540Z
Answers.Text: Looks like my issue was I didn't add quotes around the name param passed to getPost. My bad, thanks!
Answers.UserDisplayName: mjr
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-11T21:19:41.313Z
Answers.LastActivityDate: 2014-07-11T21:19:41.313Z
Answers.UserDisplayName: Marion Newlevant
Body: <p>I'm working with the contact form plugin and would like to test for post data to see if the form was just submitted.</p>
  
  <p>It seems this code always throws a template error.</p>
  
  <pre class="lang-none prettyprint-override"><code>Variable "test" does not exist
  </code></pre>
  
  <p>Is there a better way to do this?</p>
  
  <pre><code>{% set success = craft.request.getPost(test) %}
  {% if success %}
      form was just submitted
  {% endif %}
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-07-11T21:04:01.000Z
Comments.Text: What template error does it throw?
Comments.UserDisplayName: Marion Newlevant
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-07-11T21:12:56.900Z
Comments.Text: Variable "test" does not exist—I'll add it to the question if I can.
Comments.UserDisplayName: mjr
Tags: <templating><post><request><plugin-contactform>
Title: Access POST data to conditionally display form
ThreadText: # Access POST data to conditionally display form
  
  (Asked by: username_0 on 2014-07-11)
  
  I'm working with the contact form plugin and would like to test for post data to see if the form was just submitted.
  
  It seems this code always throws a template error.
  
  ```none
  Variable "test" does not exist
  
  ```
  
  Is there a better way to do this?
  
  ```
  {% set success = craft.request.getPost(test) %}
  {% if success %}
      form was just submitted
  {% endif %}
  
  ```
  
  **Tags:** templating, post, request, plugin-contactform
  
  > **Comments:**
  > **username_1**: What template error does it throw?  
  > **username_0**: Variable "test" does not exist—I'll add it to the question if I can.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2014-07-11. Score: 9 | Accepted answer
  
  I think you want this:
  
  ```
  {% set success = craft.request.getPost('test') %}
  {% if success %}form was just submitted{% endif %}
  
  ```
  
  Pass a string to `getPost()`
  
  > **Comments:**
  > **username_0**: Looks like my issue was I didn't add quotes around the name param passed to getPost. My bad, thanks!  
  
  ---
  
  ### Answer by username_2 on 2014-07-11. Score: 6
  
  If you just want to test if *something* is in POST, and don't care what it is, then this should work:
  
  ```
  {% set success = craft.request.getPost() | length %}
  
  {% if success %}
      form was just submitted
  {% endif %}
  
  ```
  
  
  ---
  
  