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?
Radio buttons have another attribute - checked or unchecked. You need to set which button was selected by the user, so you have to write PHP code inside the HTML with these values - checked or unchecked.
Use the input with type="radio" to create a radio button. Use the same name for multiple radio buttons to define a radio group. Get the value of a checked radio via the $_POST (or $_GET ) variable, depending on the request method.
The value attribute is a string containing the radio button's value. The value is never shown to the user by their user agent. Instead, it's used to identify which radio button in a group is selected.
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'];
Check whether you have put name="your_radio" where you have inserted radio tag
if you have done this then check your php code. Use isset()
e.g.
if(isset($_POST['submit']))
{
/*other variables*/
$radio_value = $_POST["your_radio"];
}
If you have done this as well then we need to look through your codes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With