Radio Buttons and Value


#1

I created a radio button for my form using this snippet of code below. The value, from what I understood from todays morning session, was what gets sent back to the database correct? By the way I hope the radio button code below is correct. Also this is my first forum post. I hope I’m not out of line.

       <label for="male">Male</label>
                <input type="radio" id="male" name="male" value="male">

 <label for="female">Female</label>
                <input type="radio" id="female" name="female" value="female">      
<label for="other">Other</label>              
                <input type="radio" id="other" name="other" value="other">

#2

Hey @1digitalnomad,

Thats partially correct. The value is what will be sent to the server (not necessarily to the database, the server would decide based on the written login, what it would do with the form data).

For the server to keep track of each of the inputs, it needs to pair the value (value="___") with a key (name="___"). So in the above example, the key (name=“male”) is ‘male’ and the value (value=“male”) is ‘male’. It’s more likely to be: key (name=“gender”) value (value=“male”) or (value=“female”).

Here is a good example https://www.w3schools.com/html/tryit.asp?filename=tryhtml_radio

PS: Yes, this is the place to ask/answer questions.