+ 1
What is Name and Value Attribute? What is their work in HTML?
Please Explain me in Easy Way.
7 ответов
+ 4
Let's assume you have a web page,with a HTML form ready. Then you place some elements in the HTML form, each these elements have their 'name' and 'value' attribute set accordingly.
For example:
[input:text] name='firstname' value='Ahamed'
[input:text] name='lastname' value='Khalifa'
When you submit the form to a back-end code for processing, the names and values will be sent as pairs, and back-end code can use those as the input to work with.
You will understand this better once you learn back-end programming.
Hth, cmiiw
+ 4
1. Radio button elements sharing the same 'name' attribute is assumed as radio button group. Radio button group only allows one selection. If the radio buttons 'name' attribute differs one another they're treated as individuals, choice isn't restricted to just one button.
2. As I explained previously, you can change the 'value' attribute manually or programmatically, but the difference will only reflect when a form is submitted to a back-end code, where you can check for difference.
3. The 'name' attribute is the identifier and 'value' attribute is the data. In back-end code it is seen as:
gender = male (or female)
4. I didn't understand the value="1 and 2" I don't see that in lesson.
Talk to me ...
+ 4
It's kind of the same case, although I admit the case of gender selection using checkboxes doesn't make sense, if both male & female checkbox were checked : )
In the checkbox case, the back-end code sees the submitted data like this:
gender = 1 (or 2)
It is the 'name' and 'value' of the checkbox that is sent to back-end code, but this time, instead of 'male' or 'female' 1 or 2 was sent.
Hope it clears the doubt.
+ 4
I guess it's because the lesson was a basic introduction to forms & inputs, at that stage 'name' and 'value' isn't really necessary. By the time we start working with a back-end code they are necessary, as the 'name' and 'value' attribute become the information identifier and data we send to the back-end code : )
+ 3
Why they not use Name Attribute in input type="submit"? Name Attribute is no need here, why?
Link: https://www.sololearn.com/learn/HTML/1035/
Click this link and go to the Last Form Elements Section, see there.
+ 1
https://www.sololearn.com/learn/HTML/1035/
Click the above link and go to the Forms Section in Html.
On there go to third Question
On the third question
The first topic type="radio" on that i removed name="gender" and it allows me to select both option, for why it allows me to select both?
And i removed both value="male and female" on the same topic but nothing happen. The value is for web server to understand what?
On the second topic value="1 and 2"
Nothing understand why 1 and 2 written?
Do you understand my question?
I collapsed you?
Sorry for grammar mistakes.
+ 1
4.see in type="checkbox" on there value="1" and value="2" written.