Use POST and GET or post and get for forms?

I’m wondering what the standard is for capitalizing “post” and “get” in the form action attribute (method=“post”), if there is one. Although I frequently see POST and GET fully capitalized in print, in code I more frequently see them in lower case. I know it probably doesn’t matter and to just be consistent, but I wonder if there are any reasons for or against. For example, most html tags/attributes are lower case.

In every reasonably reputable source I’ve seen as far as documentation goes, POST and GET are capitalized like so.

I have no idea why, and syntactically in code it makes no difference that I can tell. Probably someone here either knows the answer for why that is, or has an opinion :wink:

There isn’t one. The HTML spec states about form “method”:

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”. See the section on form submission for usage information.

(emphasis mine)

So basically you can use both lowercase or uppercase, or even mix it up (GeT), although I’d strongly suggest you don’t do that :wink:

From now on I’m writing PosT and GeT just to make people wonder… :smiley:

1 Like

I don’t know about HTML5, but I believe in HTML 4 the standardization was that everything is supposed to be in lower-case. Even though the method is case-insensitive, it would be “good form” to use lower-case. If for no reason other than just to keep things consistent.

But, as @rpkamp has pointed out, it really doesn’t matter.


HTML is not case sensitive so no matter what capitalization you use they will be correctly converted to GET and POST when they are actually processed.

If you were to specify them in an environment that is acase sensitive then you would need to specify them in all uppercase for them to work.

@felgall Do you know of such an environment? This sounds like a reason to use capitals. I am working in Windows so I can be unaware of how things might work elsewhere. Or were you referring to something like a case-sensitive programming language?

Yes - they’d need to be uppercase in that situation.

HTML doesn’t care whether things are capitalized or not - it converts them where necessary.

In HTML, it doesn’t matter. However, probably the most frequent use of POST and GET is in PHP, and it does matter in that language. The PHP variables are $_GET and $_POST, not $_get and $_post.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.