How to send value attribute from radio button in PHP

René Hansen picture René Hansen · Feb 7, 2013 · Viewed 142k times · Source

I am struggling with sending the value of a radiobutton to an email.

I have coded 2 radiobuttons, where I have set the first on to be default checked.

The form and values work, however the radio button value is not submitted.

Any wise words?

Answer

ajmal picture ajmal · Sep 23, 2013

When you select a radio button and click on a submit button, you need to handle the submission of any selected values in your php code using $_POST[] For example: if your radio button is:

<input type="radio" name="rdb" value="male"/>

then in your php code you need to use:

$rdb_value = $_POST['rdb'];