Submitting the form with an option selected would not send a useful value to the server. As such, each option needs to be given a value attribute. Without which,
###the text content of the option will be submitted to the server.###
The text content of the option will be submitted to the server, if you are not putting value attribute in it.
The question is. Isnt it a goodt thing? since the server will receive full text(?)
Your code so far
<!-- file: index.html -->
<!-- User Editable Region -->
<label>How did you hear about us?
<select>
<option>(select one)</option>
<option>freeCodeCamp News</option>
<option>freeCodeCamp YouTube Channel</option>
<option>freeCodeCamp Forum</option>
<option>Other</option>
</select>
</label>
<!-- User Editable Region -->
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
Challenge Information:
Learn HTML Forms by Building a Registration Form - Step 37
For example, when you are using <input type="button" name="foo" value="Click"/> , this will assign name ‘Click’ to your button. Same goes for text field: <input name="subject" type="text" value="Default text" /> will show you a text field with ‘Defaul text’ in it.
The reason why adding a value attribute is the best approach is that you are able to divide the logic from the presentation layer:
Think about a website with different languages, the option text would change from:
<option value="youtube">freeCodeCamp YouTube Channel</option>
to <option value="youtube">freeCodeCamp Canale YouTube</option>
So you would end up to have to build extra logic to handle multi languages in the server side while if you use the value attribute you know that will always be in English.
Translations is only one of the benefits you have by keeping this separation. another one is accessibility, screen readers and many others.