Hello, My self Arpan Tiwari and I going to present another topic in web development journey.. I have completed this lecture with Sanket Sir from PW Skills.. This snippet include that how we can create a form using HTML ?.. And many more important topics..
First of all to create a form in html we use form tag and write everything inside the form tag.. the process of creating a form structure is very interesting as it include username address contact number password and many more as per requirement..
<label for="dod">Dob :</label>
<input type="date" name="userdob" id="date">
<br>
Now to make an interesting and good looking form we can use field set tag and legend tag .. first one basically set the boundary or limit (we can say) of forms and second one indicate that what is written inside this field set..
<legend>User details!!</legend>
Form is basically important part in HTML as using this we actually take input from users that is very interesting.. Anything which we want to take as input from user write it inside the "label" tag.. for example-> Enter your name , then after give the input type with id and name (as a attribute) using input tag which is basically a self complementary tag.. Now the use of name attribute is basically it tells the server that what the user is written inside it..
<label for="name">Enter your name :</label>
<input type="text" id="name" name="username">
<br>
This way you can take many inputs from user.. Now another important thing is if we need to allow user to select one option from many option then what we can do.. for example-> select gender i.e. male or female then we have to give same input name attribute to all options which are available..
Select gender: <br>
<label for="male">Male</label>
<input type="radio" id="male" name="gender">
<br>
<label for="female">Female</label>
<input type="radio" id="female" name="gender">
<br>
Now, another thing is in case of selection of options we use radio input type attribute that makes it optional and you can tick .. If we need to allowed user to select multiple options then we give checkbox input type attribute that allows to select more than one option..
Select favourite movies : <br>
<label for="avengers">Avengers</label>
<input type="checkbox" name="Avengers" id="Avengers">
<br>
<label for="Thor">Thor</label>
<input type="checkbox" name="Thor" id="Thor">
<br>
<label for="Ironman">Ironman</label>
<input type="checkbox" name="Ironman" id="Ironman">
<br>
Another thing which is very important is that if we need to allow user to write multiple lines in a single option like as Enter your full address some user can have multiple line address then we basically use "text area" tag that allows to do it..
<label for="address">Enter your address :</label>
<textarea name="useraddress" id="address" cols="30" rows="10"></textarea>
<br>
So this was all about this snippet and I hope this will be helpful.. Thank You..