about forms | Sololearn: Learn to code for FREE!

+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 />

5/17/2017 8:43:35 AM

Pulkit Indora

7 Answers

New Answer

+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.

+3

then you can't address those fields. you won't be able to use their values.

+3

of course. you decide the names. but for radio buttons and checkboxes you have to use the same name to group them.

0

what will happen if i am not using this. means i am not going to write anything then what will happen???

0

This is used to get POST or GET value.

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 />

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.