PDA

View Full Version : HTML Forms Tag



Forum Guru
11-26-2014, 05:16 PM
This tutorial is about HTML Forms. How you can create Form Through HTML Tags. Forms play an important role in a website. You can take values from user through forms. And most of website ask for comments on their post through forms. And you also make back-end of your website through which you are updating your website. It’s all possible through HTML Forms. You can take values through Forms. A lot of website takes surveys. They are also using HTML Forms. Every website using forms to utilize their website in different website. And Most of website you can see that their will be a login and signup form. How you can create form. In this tutorial you will learn that what you can do through different tags. In my next tutorial I will make a HTML Form.


HTML Forms Tag


It’s depend on you that what you want to take from users. And remember that All tags will become in <form> </form> tags. Between these two tags you will write all code about forms. If you want to take username of a user then what you have need to do this. You want to enter characters and numbers. It means that you need a text field. And if you want to apply limits on it then you can also apply limits. If you will apply limit of 20 characters then you can write only 20 characters in that text field. You can see Below Code For Text Field :


Username : <input type=”text” name=”username” maxlength=”20″>
Name Field plays an important role in Fields. If you don’t have name of any field then you can’t send your data to website. When we will move towards PHP then you will understand name attribute. After that which field you need. You want to enter Email of any person/user then you have need a text box. You can use above code for Email. You have need to type Email except Username and in name attribute give another name. You must care that every field should different name from others but in Radio Button name attribute will be same. Now you want to take password of user then you will write below code :


Password : <inout type=”password” name=”user_password” maxlength=”50″>
You can give any name to value of name attribute. If you are making a Signup Form then make a Confirm Password Field Using Above Logics. But remember that the value of attribute ‘name’ will be different. After that you want to make a radio button for gender then you have need to type following code. The value of attribute ‘name’ will be same in radio buttons :


Gender :


<input type=”radio” name=”gen” value=”male”> Male <input type=”radio” name=”gen” value=”female”>
You will give different values that you want in above code. Here you will see that you can only select one option from above. Because you can be a male / female. Therefore you will use here radio buttons. You can also use Select option Accept radio buttons. For Asking user age you can also use Select tags. Take a Look on Below Example :


<select name=”gender”>


<option value=”male”>Male</option>


<option value=”Female”>Female</option>


</select>
If you want to check hobbies of user from specific values then you can use check-box. Because you can check more than one box at a time. And a User can have more than one hobbies. For Check Box you can see below code :


<input type=”checkbox” name=”sports” value=”ckt”>Cricket


<input type=”checkbox” name=”sports” value=”hock”> Hockey


<input type=”checkbox” name=”sports” value=”ft”> Football


<input type=”checkbox” name=”sports” value=”tenn”> Tennis
And After that you will submit this data to server. Here you have need to Submit button. If you want to clear all data then their will be a button for reset. It will makes empty all form that you will fill with some values. See Below Code :


<input type=”submit” name=”submit” value=”submit”>


<input type=”reset” value=”Reset”>
You can give any name to any attributes. It’s depend on you that how you want to use that tags. There are more tags in forms. And also have many attributes. We will studied them later. How you will use them. I will teach you everything with the passage of time. How you can create better looking HTML Forms I will teach you later. First you need to remember these tags. Keep Visiting My Website For Latest Tutorials. This was the End OF HTML Forms Tutorial Today.