logo Learn HTML
  • Home
  • Tutorials
  • Practice
  • Quiz
  • Projects
  • About
  • Contact

HTML Course

  • HTML HOME
  • HTML Introduction
  • HTML Basic
  • HTML Element
  • HTML Attributes
  • HTML Headings
  • HTML Paragrapha
  • HTML Style
  • HTML Formattin
  • HTML Quotations
  • HTML Colors
  • HTML Css
  • HTML Links
  • HTML Image
  • HTML Favicon
  • Page Tittle
  • HTML Tables
  • HTML Lists
  • Block & Inline
  • HTML Div
  • HTML Classes
  • HTML Id
  • HTML Buttons
  • HTML Iframes
  • HTML File Paths
  • HTML Head
  • HTML Layout
  • HTML Symbols
  • HTML Emojis
  • HTML URL Encode
  • HTML VS XHTML
  • HTML FROM
  • HTML Form
  • Form Attributes
  • Form Elements
  • HTML Input Types
  • HTML Input Attributes
  • Input Form Attributes
  • HTML Graphics
  • HTML Canvas
  • HTML SVG
  • HTML Media
  • HTML Media
  • HTML Video
  • HTML Audio
  • HTML Plug-ins
  • HTML Youtube
  • HTML APIS
  • HTML Web APIS
  • HTML Geolocation
  • HTML Drag & Drop
  • Web Storage
  • Web Workers
  • HTML SSE
  • HTML Examples
  • HTML Examples
  • HTML Editor
  • HTML Quiz
  • HTML Exercises
  • HTML References
  • HTML Tag List
  • HTML Attributes
  • HTML Global Attributes
  • HTML Brower Support
  • HTML Events
  • HTML Colors
  • HTML Canvas
  • HTML Audio & Video
  • HTML Doctypes
  • HTML Character Sets
  • HTML URL Encode
  • Language Codes
  • HTTP Messages
  • HTTP Methods
  • PX to EM Converter
  • keyboard Shortcuts

Form

Connects an <input> to a specific <form> (even if the input is outside the form).

👉 The value must match the id of the <form>

<Form action="/action_page.php" id="form1">
<input type="text" name="fname">
<input type="submit" value="submit">

<input type="text" name="lname" form="form1">
</Form>

formaction

Defines a different URL for submitting the form.

👉 Overrides the form's action attribute

👉 Works with type="submit" and type="image".

<Form action="/action_page.php">
<input type="submit" value="Normal Submit">
<input type="submit" formaction="/admin_page.php" value="Submit as Admin">
</Form>

formenctype

Specifies how form data should be encoded (only with method="post")

Overrides form's enctype.

Works with submit and image types.

Common value:

  • multipart/form-data` (used for file uploads)
<form action="/upload.php" method="post">
<type="submit" value="Normal Submit">
<input type="submit" formenctype="multipart/form-data" value="Upload File">
</form>

formmethod

Defines the HTTP method (`get` or `post`).

Overrides form's method.

GET

  • Data added in URL
  • Visible in address bar
  • Not secure
  • Limited size

POST

  • Data sent in HTTP body
  • More secure
  • No size limit
  • Cannot bookmark

<form action="/action.php" method="get">
<tinput type="submit" value="Submit using GET">
<input type="submit" formmethod="post" value="Submit using POST">
</form>

formtarget

Specifies where to display the response.

Common values:

  • _self (same page)
  • _blank (new tab)
<form action="/action.php">
<input type="submit" value="Submit">
<input type="submit" formtarget="_blank" value="Open in New Tab">
</form>

formnovalidate

Disables validation for that specific submit button.

<form action="/action.php">
<input type="email" name="email">
<input type="submit" value="Validate">
<input type="submit" formnovalidate value="Submit without Validation">
</form>

Novalidate (Form Attribute)

Disables validation for the whole form.

<form action="/action.php" novalidate>
<input type="email" name="email">
<input type="submit">
</form>

Quick Summary Table

Attribute Purpose
form Connect input to form
formaction Change submit URL
formenctype Change encoding type
formmethod Change GET/POST
formtarget Change response location
formnovalidate Disable validation (button only)
formenctype Disable validation (whole form)

Try It Your Self

Sign Up For New
Update

HTML Basic
  1. HTML Basic
  2. HTML Element
  3. HTML Attributes
  4. HTML Headings
  5. HTML Paragrapha
  6. HTML Tables
  7. HTML Lists
HTML Advance
  1. HTML Div
  2. HTML Classes
  3. HTML Id
  4. HTML Buttons
  5. HTML Iframes
  6. HTML Symbols
  7. HTML Emojis