Why do we put yes in the `value` and in the `label`?

please explain briefly
<input id=“answer” name=“burger” value="yes" type=“radio”>YES

please why is there two values when we have already add a value of yes in the input element> and another >yes< again.
and explain more on id attribute

When we give an INPUT element an ID attribute, it is there as a hook for a LABEL.

<input id=“burger” name=“burger” value="yes" type=“radio”>
<label for="burger">YES</label>

or

<label for="burger">YES</label>
<input id=“burger” name=“burger” value="yes" type=“radio”>

The text in the label goes to the screen, the value goes to the POST data with the name burger

burger = 'yes'

Extended

<label>YES
<input name=“burger” value="yes" type=“radio”>
</label>

or

<label>
<input name=“burger” value="yes" type=“radio”>
YES</label>

Note above that the label wraps the input control. In that case we do not apply an ID attribute since the control is a child of the label.

23 Likes