0
Why the code in sololearn use value="1"in checkbox ?
3 Respuestas
+ 3
Aditya, for example assume we have a text input <input type="text" name="my_name" /> if we write something into this input (i.e. "SoloLearn"), and submit the form that hosted it, the back-end code receives a pair of information with the request, looking something like this "<name>=<data>", where <name> is the key, e.g. "my_name" (the text input `name` attribute), and <data> is value, e.g. "SoloLearn" (the text input `value` attribute). If there are input which allows multiple selection, such as checkboxes, it *may* be treated as array (in PHP for example).
Hth, cmiiw
+ 5
The `name` and `value` attribute of an element is submitted as a key-value pair when a form where the element is hosted is submitted, you will understand it when you start learning back-end programming 👍
+ 1
What is key value pair??