about forms | Sololearn: Learn to code for FREE!


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


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.


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


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


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


This is used to get POST or GET value.


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


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.