Having trouble understanding name and id and value in forms

Absolutely new learner here. Im having difficulty understanding name and id and value in forms. which is used for what and what does each do?

because i see that people often use the name text for all three…

like say <input type=“radio” name=“gender” id=“gender” value=“gender”

whats up with this?

Hi. These are all called attributes. W3 Schools have good pages on what these various attributes do. See for example

The ID attribute is a useful reference point. If you have done the HTML projects on FCC they give good examples of their use in a web page.

i saw the html basics video. do you mean that one when you say projects?

In your radio button example, the name and value would be sent as a key/value pair in the form scope when the form is submitted. So, in this case, you would see gender=gender. That wouldn’t be very useful though, would it? Rather, you’d want something meaningful like “male” or “female” for your radio button values. For a set of radio buttons or checkboxes, the name is also used to group them, so you can have several radio buttons or checkboxes with the same name.

An id, however, must be unique and is often used to reference an HTML element in JavaScript using syntax like document.getElementById(“gender”).

Is that on the new full stack curriculum? Yes they also explain it there. Also on the old curriculum of Responsive web design such as the cat photo app, the registration form. You can visit the curriculum by clicking the top left hand corner.