Question

I realize that both will work, but is one more correct than the other?

<form method="POST" />

vs.

<form method="post" />

Why use one or the other?

Was it helpful?

Solution

W3C has tended towards lowercase for attribute names and values for a while.

For example section 4.11 of the xhtml 1.0 standard in 2002:

4.11. Attributes with pre-defined value sets

HTML 4 and XHTML both have some attributes that have pre-defined and limited sets of values (e.g. the type attribute of the input element). In SGML and XML, these are called enumerated attributes. Under HTML 4, the interpretation of these values was case-insensitive, so a value of TEXT was equivalent to a value of text. Under XML, the interpretation of these values is case-sensitive, and in XHTML 1 all of these values are defined in lower-case.

OTHER TIPS

You can use either of them why because HTML is not case-sensitive markup language.

See HTML 4.01 Specification

The value is case-insensitive (i.e., user agents interpret "a" and "A" as the same).


Note that XHTML should be lower case.

4.2. Element and attribute names must be in lower case

XHTML documents must use lower case for all HTML element and attribute names. This difference is necessary because XML is case-sensitive e.g. <li> and <LI> are different tags.

Either way is fine for HTML. There is not specific recommendation.

Possible (case-insensitive) values are "get" (the default) and "post".

There are arguments for both uppercase and lowercase. One could say that the default for HTML (and mandatory for XHTML) tokens is to write them in lowercase, but saying that the values used in HTTP requests are the uppercase ones is equally valid.

Either is fine. It's not case sensitive. w3schools implies the w3c recommends lower case for HTML: http://www.w3schools.com/html/html_attributes.asp

Here is the w3c XHTML lower-case requirement for attributes: http://www.w3.org/TR/xhtml1/#h-4.2

As with most coding conventions, consistency is key. Pick the casing you are most comfortable with and make sure to use it throughout your code.

From the HTML 4.01 Recommendation:

This attribute specifies which HTTP method will be used to submit the form data set. Possible (case-insensitive) values are "get" (the default) and "post".

XHTML is different, and the attribute values there are case sensitive and must be lower case.

Under HTML 4, the interpretation of these values was case-insensitive, so a value of TEXT was equivalent to a value of text. Under XML, the interpretation of these values is case-sensitive, and in XHTML 1 all of these values are defined in lower-case.

The above is from XHTML 1.0 (Hat tip to @amelvin for spotting something I assumed was another case of an undocumented change).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top