Form Tag
Forms are required to take input from the user who visits the website. This form is used basically for the registration process, logging into your profile on a website or to create your profile on a website, etc … The information that is collected from the form is -1. Name 2.Email Addresses etc. Now the form will take input from the form and post that data in backend applications (like PHP). So the backend application will process the data which is received by them. There are various form elements that we can use like text fields, text area, drop-down list, select, checkboxes, radio, etc.
Syntax:
<form> Form Content... </form>
Attributes: There are many attributes that are associated with the <form> tag. Some of them are listed below:
- Action Attribute: -This is used to send the data to the server after the submission of the form.
- Method: -This is used to upload the data by using two methods that are Get and Post. Get Method: -It has a limited length of characters of URL. -we should not use get to send some sensitive data. -This method is better for non-secure data. Post Method: -1. It has no size limitations 2. The submission of the form with the method post, can not be bookmarked.
- Enctype attribute: -This attribute is used to specify that how a browser decodes the data before it sends it to the server .so the values of this attribute are: -1.application/x-www-form-urlencoded − It is the standard method most forms used 2.multipart/form-data -it is used when you have something to upload like files of images, word files, etc.
Example of the form tag:-
HTML
<!DOCTYPE html>
< html >
< body >
< h1 >form tag </ h1 >
< form >
< label for = "fname" >FirstName</ label >
< input type = "text" name = "fname" placeholder = "enter your name" required>
< label for = "lname" >LastName</ label >
< input type = "text" name = "lname" placeholder = "enter your name" required>
</ form >
</ body >
</ html >
|
Output:

Supported Browsers:
- Google Chrome
- Edge 12
- Internet Explorer
- Firefox
- Opera
- Safari
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
22 Jul, 2022
Like Article
Save Article