Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML HTML Forms Choosing Options Radio Buttons

Sahar Nasiri
Sahar Nasiri
7,454 Points

Input and Value

Why do Nick add value to the input in this video? we didn't use value!

Sina Maleki
Sina Maleki
6,135 Points

Salam. baraye inke vaghti form ro submit mikoni data morede nazer(value) bargarde. masaln agar taraf radio "under_13" ro entekhab kard, agar value="-13" samte server bar migarde. Best

Sina Maleki
Sina Maleki
6,135 Points

Salam. baraye inke vaghti form ro submit mikoni data morede nazer(value) bargarde. masaln agar taraf radio "under_13" ro entekhab kard, agar value="-13" samte server bar migarde. Best

2 Answers

For the input types we saw before this video (i.e. text, email, password), whatever the user types in is considered to be the "value" of that input element. To illustrate this better, check out the code below. Both lines send over the same "value" to the server when you submit the form:

<!-- You type in "Sahar" in the input field -->
<input type="text" id="name" name="user_name">

<!-- When the form loads in your browser, the field will be pre-populated with "Sahar" -->
<input type="text" id="name" name="user_name" value="Sahar">

Radio buttons are just another type of input element where the type is set as "radio". Instead of having a user type something in, we want each radio button to have a specific value. So for this particular video, if we click "Under 13" and submit our form, then we send the value of "under_13" to the server. Same with "Over 13" - once we submit the form, we send the value of "over_13" to the server.

jeremy hudson
jeremy hudson
2,589 Points

it could have been a example but he will go over what he did in future videos but if your willing to visit w3schools every little info is on there happy coding