I would appreciate some help with the exercise below, as I didn’t get an understanding
of the concept. It concerns the checkbox input on page 7 of lesson 4 on HTML:
So, if I understand your question correctly–
When an input is sent to a server via POST, the server receives the name (if given) and the value. This example should help you understand:
That should be true, yes.
But the value of the attribute “value” is set BEFORE the user’s choice.
So, even if the user didn’t check the box “Lettuce”, the value is still true.
Isn’t that right?
The standard behavior for a checkbox is that it only sends its value to the server if it is checked.
Consider it like pressing an “on” button. Only the buttons that are “on” will be sent to the server and the buttons that are “off” are not–but, you still want the “off” buttons to have a value for when they are inevitably switched “on”
Does that help you out? Or are you wondering something else?