HTML Form is used to collect the user information such as name, age, address, Mobile number, gender, qualification etc.
In HTML Form user information sent to a server for processing. In HTML Form used <form> tag to create form.
In HTML Form user information sent to a server for processing. In HTML Form used <form> tag to create form.
HTML Form Tags are:-
<form>
<input>
<textarea>
<label>
<button>
<option>
<legent>
<select>
HTML <form> Tag
The HTML <form> tag provide a document section to take input from user. information sent to the server.
Syntax:-
<form>
//form element
</form>
HTML <input> Tag
The HTML <input> tag is fundamental form element. It is used to create a text field to take input from user.
Example:-
<form>
<body>
<form>
Enter Name <br>
<input type="text" name="name">
</form>
</body>
</form>
Output:-

HTML <textarea> Tag
The <textarea> tag is used to create a multiple line text in form.
Example:-
<html>
<head>
<title>HTML Form</title>
</head>
<body>
<form>
Enter your Message:<br>
<textarea rows="2" cols="20"></textarea>
</form>
</body>
</html>
Output:-

HTML TextField
Textfield is a single line text in form. type="text" attribute in input tag to create a single line textfield.
Example:-
<html>
<head>
<title>HTML Form</title>
</head>
<body>
<form>
First Name: <input type="text" name="firstname"/> <br>
Last Name: <input type="text" name="lastname"/> <br>
</form>
</body>
</html>
Output:-

HTML <label> Tag
Label Tag is used to display the field name.
Example:-
<html>
<head>
<title>Form in HTML</title>
</head>
<body>
<form>
<label for="firstname">First Name: </label> <br>
<input type="text" id="firstname" name="firstname"/> <br>
<label for="lastname">Last Name: </label> <br>
<input type="text" id="lastname" name="lastname"/> <br>
</form>
</body>
</html>
Output:-

0 Comments
Post a Comment
Please do not enter any spam in the comment box.