<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>

CC BY-SA 3.0
2015-02-17T21:44:03.970Z
2015-02-17T21:44:03.970Z
Aaron Berkowitz
<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>

CC BY-SA 4.0
2018-06-28T20:22:13.903Z
In CraftCMS, is there a folder named 'actions'?  I was thinking that the requirement is to have the folder named 'plugins'?  Thanks.
buck1112
<form><php><post>
Get _POST from Select element in Form
# 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:
 
    
        View
        Submit
    
    
    


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. 

View
Submit




That should do the trick!


---

