0

Why the code in sololearn use value="1"in checkbox ?

https://code.sololearn.com/W2IARxgLf23j/?ref=app

4th Feb 2019, 7:32 PM
Aditya
Aditya - avatar
3 odpowiedzi
+ 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
5th Feb 2019, 5:22 AM
Ipang
+ 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 👍
4th Feb 2019, 8:46 PM
Ipang
+ 1
What is key value pair??
5th Feb 2019, 4:10 AM
Aditya
Aditya - avatar