HTML Form Attributes
The Action Attribute
The action attribute specifies where to send the form data when submitted. It usually points to a server-side script.
HTML
CSS
JS
The Method Attribute
The method attribute specifies how to send form data:
GET- Appends data to URL (visible, bookmarkable, limited size)POST- Sends data in request body (hidden, no size limit)
HTML
CSS
JS
Best Practice: Use GET for searches and filters. Use POST for sensitive data like passwords or when modifying data.
The Enctype Attribute
The enctype specifies how form data should be encoded. It's required for file uploads:
application/x-www-form-urlencoded- Default, encodes all charactersmultipart/form-data- Required for file uploadstext/plain- Sends data without encoding (not recommended)
HTML
CSS
JS
Other Form Attributes
target- Where to display response (_self, _blank, _parent, _top)autocomplete- Enable/disable browser autocomplete (on/off)novalidate- Disable browser validationname- Name for the form (used in JavaScript)
Quick Quiz
Which enctype is required for file uploads?
Enjoying these tutorials?