Answers.Body: <p>Form elements need to have a name attribute. </p>
  
  <pre><code>&lt;select name="submission" id="submission"&gt;
  &lt;option value="view"&gt;View&lt;/option&gt;
  &lt;option value="submit"&gt;Submit&lt;/option&gt;
  &lt;/select&gt;
  
  &lt;textarea name="content" rows="9" cols="80" id="content"&gt;&lt;/textarea&gt;
  </code></pre>
  
  <p>That should do the trick! </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-17T21:44:03.970Z
Answers.LastActivityDate: 2015-02-17T21:44:03.970Z
Answers.UserDisplayName: Aaron Berkowitz
Body: <p>I'm  trying to get the _POST data for my form in a plugin, and for whatever reason am unable to get the selected option from a select tag:</p>
  
  <pre><code> &lt;form class="parseResults" action="actions/MyPlugin/myFunctionAjax" method="post" name="submitResults"&gt;
      &lt;select name="submission"&gt;
          &lt;option value="view"&gt;View&lt;/option&gt;
          &lt;option value="submit"&gt;Submit&lt;/option&gt;
      &lt;/select&gt;
      &lt;textarea rows="9" cols="80" name="content"&gt;&lt;/textarea&gt;
      &lt;input type="submit" value="Submit" name="submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>And then in my plugin, I can get the textarea form content like:</p>
  
  <pre><code>    $formContent = craft()-&gt;request-&gt;getPost('content');
  </code></pre>
  
  <p>But when I try to get the selected option from the #submission select, nothing returns</p>
  
  <pre><code>    $submissionType = craft()-&gt;request-&gt;getPost('submission');
  </code></pre>
  
  <p>What am I missing or doing wrong in order to get the selected option?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-06-28T20:22:13.903Z
Comments.Text: In CraftCMS, is there a folder named 'actions'?  I was thinking that the requirement is to have the folder named 'plugins'?  Thanks.
Comments.UserDisplayName: buck1112
Tags: <form><php><post>
Title: Get _POST from Select element in Form
ThreadText: # Get _POST from Select element in Form
  
  (Asked by: username_0 on 2015-02-17)
  
  I'm trying to get the \_POST data for my form in a plugin, and for whatever reason am unable to get the selected option from a select tag:
  
  ```
   <form class="parseResults" action="actions/MyPlugin/myFunctionAjax" method="post" name="submitResults">
      <select name="submission">
          <option value="view">View</option>
          <option value="submit">Submit</option>
      </select>
      <textarea rows="9" cols="80" name="content"></textarea>
      <input type="submit" value="Submit" name="submit">
  </form>
  
  ```
  
  And then in my plugin, I can get the textarea form content like:
  
  ```
      $formContent = craft()->request->getPost('content');
  
  ```
  
  But when I try to get the selected option from the #submission select, nothing returns
  
  ```
      $submissionType = craft()->request->getPost('submission');
  
  ```
  
  What am I missing or doing wrong in order to get the selected option?
  
  **Tags:** form, php, post
  
  > **Comments:**
  > **username_1**: In CraftCMS, is there a folder named 'actions'?  I was thinking that the requirement is to have the folder named 'plugins'?  Thanks.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2015-02-17. Score: 2 | Accepted answer
  
  Form elements need to have a name attribute.
  
  ```
  <select name="submission" id="submission">
  <option value="view">View</option>
  <option value="submit">Submit</option>
  </select>
  
  <textarea name="content" rows="9" cols="80" id="content"></textarea>
  
  ```
  
  That should do the trick!
  
  
  ---
  
  