Last Updated on April 26, 2023 by Roshan Parihar
HTML Form tag is used when you want to collect your website users or visitors data.
A form contains many controls such as input field, password field, radio buttons, checkboxes, submit buttons etc.
Syntax
1 2 3 |
<form action="script url" method="get or post"> form elements to put here like input, checkbox etc. </form> |
This is the example for attribute enctype, you can use this example to upload form data in format of files.
1 2 3 |
<form action="#" method="post" enctype="mutlipart/form-data"> <input type="file" name="myfile" id="fileupload"/> </form> |
Output
List of HTML form tag attributes
Sr. No. | target atribute options | Description |
---|---|---|
1 | action | This attribute contains the url of script file that handles the form data. |
2 | method | This specified the HTTP method GET and POST to be used when submitting the form data. |
3 | target | This specified the target window where we want to display the script. The values of this attribute are _blank, _self, _parent, _top. |
4 | enctype | This attribute can be used when you want to upload files like image, doc etc. The value for this is mutlipart/form-data. |
List of HTML form tags
Sr. No. | tags | |
---|---|---|
1 | <Input> | This tag defines input control with various types like text, email, checkbox etc. See HTML input tag for more details. |
2 | <button> | This is used to show clickable button. See HTML button tag for more details. |
3 | <option> | This is used inside select tag to show selectable options. See HTML option tag for more details. |
4 | <label> | This is used to show label of input field. See HTML label tag for more details. |
5 | <textarea> | This use to shows the multiline input text. See HTML textarea tag for more details. |
6 | <select> | This is used to show select options of input field. See HTML select tag for more details. |
Resources and References
1. W3C Specification.
2. HTML living standard
3. W3C project using Github