<p>I have solved it by myself;</p>

<pre><code>$application = $event-&gt;sender-&gt;application;
</code></pre>

<p>Even for radio button's value, no suffix is necessary like <code>value</code>.</p>

CC BY-SA 4.0
2019-07-05T19:43:07.450Z
2019-07-05T19:43:07.450Z
Kota.M
<p>I have been developing validations for my form.</p>

<p>It is possible to get text input's value like;</p>

<p><code>$password = Craft::$app-&gt;request-&gt;getBodyParam('password');</code></p>

<p>However, this function seems not to work for radio button fields. Could you tell me how to get radio button's value?</p>

CC BY-SA 4.0
2019-07-04T17:37:48.457Z
I found that getBodyParam function's param is the element's id. However, for radio button, the key must be name. What should I do?
Kota.M
<craft3><form><php>
Get radio button's value from a form by PHP
# Get radio button's value from a form by PHP

(Asked by: username_0 on 2019-07-04)

I have been developing validations for my form.

It is possible to get text input's value like;

`$password = Craft::$app->request->getBodyParam('password');`

However, this function seems not to work for radio button fields. Could you tell me how to get radio button's value?

**Tags:** craft3, form, php
> **Comments:**
> **username_0**: I found that getBodyParam function's param is the element's id. However, for radio button, the key must be name. What should I do?  

---

## 1 answers

### Answer by username_0 on 2019-07-05. Score: 1

I have solved it by myself;
$application = $event->sender->application;

Even for radio button's value, no suffix is necessary like value.


---

