HTML Form

The HTML form tag is used to add a form to your website and get user input data. A user input data can be the name, email and the query message from the user.

You can add a newsletter to your blog using a form to get the email id of the user. After you get an email, you can fire blog posts daily to your subscribers.

Syntax

For Example:

This is the example for attribute enctype, you can use this example to upload form data in format of files.

Test it Live

Output


List of HTML form tag attributes

Sr. No. form atribute options Description
1 action action URL contains the location of the script file that handles the form data.
2 method An HTTP method GET and POST can be used when submitting the form data.
3 target The target attribute ise used when you want visitors to run the script in the new or same window. The values of this attribute are _blank, _self, _parent, _top.
4 enctype enctype attribute is used when you want to upload files like image, doc etc. Use valus mutlipart/form-data. for this.

List of HTML form Elements

Sr. No. tags
1 <Input> Define input control inside the form. This is of various types like text, email, checkbox etc. Checkout HTML input tag for more details.
3 <button> A clickable button can be define using this tag. Checkout HTML button tag to learn more about this.
4 <option> HTML option tag is used to show selectable options.
5 <label> When you want to show labels for form elements, you use HTML label tag.
6 <textarea> To get message from users, a multiline input text is required. Use HTML textarea tag to to do this.