+ 1

about forms

What is the need of this 'name' in the forms and why it is used? What will happen if i will not put "gender" in the name amd will put something else???? <input type="radio" name="gender" value="male" /> Male <br /> <input type="radio" name="gender" value="female" /> Female <br />

17th May 2017, 8:43 AM
Pulkit Indora
Pulkit Indora - avatar
7 Answers
+ 4
it's needed to address the elements themself and their values. either in JavaScript, php, ruby or any other language which can process the form data.
17th May 2017, 8:46 AM
Mario L.
Mario L. - avatar
+ 3
then you can't address those fields. you won't be able to use their values.
17th May 2017, 8:50 AM
Mario L.
Mario L. - avatar
+ 3
of course. you decide the names. but for radio buttons and checkboxes you have to use the same name to group them.
17th May 2017, 8:58 AM
Mario L.
Mario L. - avatar
0
what will happen if i am not using this. means i am not going to write anything then what will happen???
17th May 2017, 8:49 AM
Pulkit Indora
Pulkit Indora - avatar
0
This is used to get POST or GET value.
17th May 2017, 8:54 AM
Vishal Prajapati
0
suppose i am going with the above example of gender. can i address them with anything else i.e. <input type="radio" name="nothing" value="male" /> Male <br /> <input type="radio" name="nothing" value="female" /> Female <br />
17th May 2017, 8:54 AM
Pulkit Indora
Pulkit Indora - avatar
0
we use radio button where we want user to select only one option. We use name attribute to group radio buttons we can have any value there, all the radio buttons with same name will be grouped. User can select only one of them.
17th May 2017, 2:17 PM
Eranga
Eranga - avatar