W3Schools.com (2024)


Example

An HTML form with two input fields and one submit button:

<form action="/action_page.php" method="get">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"><br><br>
<input type="submit" value="Submit">
</form>

Try it Yourself »

More "Try it Yourself" examples below.

Definition and Usage

The <form> tag is used to create an HTML form for user input.

The <form> element can contain one or more of the following form elements:

Browser Support

Element
<form> Yes Yes Yes Yes Yes

Attributes

Attribute Value Description
accept-charset character_set Specifies the character encodings that are to be used for the form submission
action URL Specifies where to send the form-data when a form is submitted
autocomplete on
off
Specifies whether a form should have autocomplete on or off
enctype application/x-www-form-urlencoded
multipart/form-data
text/plain
Specifies how the form-data should be encoded when submitting it to the server (only for method="post")
method get
post
Specifies the HTTP method to use when sending form-data
name text Specifies the name of a form
novalidate novalidate Specifies that the form should not be validated when submitted
rel external
help
license
next
nofollow
noopener
noreferrer
opener
prev
search
Specifies the relationship between a linked resource and the current document
target _blank
_self
_parent
_top
Specifies where to display the response that is received after submitting the form

Global Attributes

The <form> tag also supports the Global Attributes in HTML.

Event Attributes

The <form> tag also supports the Event Attributes in HTML.

More Examples

Example

An HTML form with checkboxes:

<form action="/action_page.php" method="get">
<input type="checkbox" name="vehicle1" value="Bike">
<label for="vehicle1"> I have a bike</label><br>
<input type="checkbox" name="vehicle2" value="Car">
<label for="vehicle2"> I have a car</label><br>
<input type="checkbox" name="vehicle3" value="Boat" checked>
<label for="vehicle3"> I have a boat</label><br><br>
<input type="submit" value="Submit">
</form>

Try it Yourself »

Example

An HTML form with radiobuttons:

<form action="/action_page.php" method="get">
<input type="radio" id="html" name="fav_language" value="HTML">
<label for="html">HTML</label><br>
<input type="radio" id="css" name="fav_language" value="CSS" checked="checked">
<label for="css">CSS</label><br>
<input type="radio" id="javascript" name="fav_language" value="JavaScript">
<label for="javascript">JavaScript</label><br><br>
<input type="submit" value="Submit">
</form>

Try it Yourself »

Related Pages

HTML tutorial: HTML Forms and Input

HTML DOM reference: Form Object

CSS Tutorial: Styling Forms

Default CSS Settings

Most browsers will display the <form> element with the following default values:

Example

form {
display: block;
margin-top: 0em;
}

Try it Yourself »

W3schools Pathfinder

Track your progress - it's free!

W3Schools.com (2024)
Top Articles
Mastercard, BitOasis to launch crypto-linked cards in MENA region
8 Tips to Perfect Your Marathon Hydration Strategy
Ohio Houses With Land for Sale - 1,591 Properties
Average Jonas Wife
Uihc Family Medicine
Plaza Nails Clifton
Seething Storm 5E
No Hard Feelings Showtimes Near Metropolitan Fiesta 5 Theatre
What's Wrong with the Chevrolet Tahoe?
Oriellys St James Mn
Www.paystubportal.com/7-11 Login
Synq3 Reviews
454 Cu In Liters
Echo & the Bunnymen - Lips Like Sugar Lyrics
Kaomoji Border
Northern Whooping Crane Festival highlights conservation and collaboration in Fort Smith, N.W.T. | CBC News
Grandview Outlet Westwood Ky
No Hard Feelings - Stream: Jetzt Film online anschauen
ELT Concourse Delta: preparing for Module Two
Nearest Walgreens Or Cvs Near Me
Acts 16 Nkjv
Walmart Near South Lake Tahoe Ca
Weve Got You Surrounded Meme
Jeff Nippard Push Pull Program Pdf
Black Lion Backpack And Glider Voucher
Vivification Harry Potter
Skepticalpickle Leak
Datingscout Wantmatures
Issue Monday, September 23, 2024
Halsted Bus Tracker
Where Can I Cash A Huntington National Bank Check
Dumb Money, la recensione: Paul Dano e quel film biografico sul caso GameStop
Kaiju Paradise Crafting Recipes
Mp4Mania.net1
The Best Carry-On Suitcases 2024, Tested and Reviewed by Travel Editors | SmarterTravel
Retire Early Wsbtv.com Free Book
R&J Travel And Tours Calendar
Reborn Rich Ep 12 Eng Sub
8 Ball Pool Unblocked Cool Math Games
Check From Po Box 1111 Charlotte Nc 28201
Busted Newspaper Campbell County KY Arrests
Candise Yang Acupuncture
Enr 2100
Movie Hax
The Blackening Showtimes Near Ncg Cinema - Grand Blanc Trillium
Walmart Front Door Wreaths
Lsreg Att
Inside the Bestselling Medical Mystery 'Hidden Valley Road'
Room For Easels And Canvas Crossword Clue
Latest Posts
Article information

Author: Sen. Emmett Berge

Last Updated:

Views: 5641

Rating: 5 / 5 (60 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Sen. Emmett Berge

Birthday: 1993-06-17

Address: 787 Elvis Divide, Port Brice, OH 24507-6802

Phone: +9779049645255

Job: Senior Healthcare Specialist

Hobby: Cycling, Model building, Kitesurfing, Origami, Lapidary, Dance, Basketball

Introduction: My name is Sen. Emmett Berge, I am a funny, vast, charming, courageous, enthusiastic, jolly, famous person who loves writing and wants to share my knowledge and understanding with you.