The <form> Tag

Contact Us or call 1-877-932-8228
The <form> Tag

The <form> Tag

HTML forms are created using the <form> tag, which takes two main attributes: action and method.

The action specifies the URL of the page that processes the form. It is required. The method attribute has two possible values: post and get. A basic form tag is shown below:

<form method="post" action="Register.cfm">
	<!--form fields go here-->

Get vs. Post

The value of the method attribute is used to determine how the form data will be passed to the server.


If get is used the data will be appended to the URL as part of a querystring. For example, if the form is filled out as follows:

When the user submitted the form, the URL for the new page would read (without the line breaks):


You'll notice the file name is followed by a question mark, which is followed by several name-value pairs (e.g, container=wafflecone) separated by ampersands (&).

The get method is commonly used by search engines, because it allows the resulting page to be bookmarked.


When post is used, the name-value pairs are not sent as part of the querystring. Instead they are sent behind the scenes. This has the advantage of keeping the values hidden from anyone looking over the user's shoulder. Two other advantages of the post method are:

  1. It allows for much more data to be submitted (i.e, larger forms).
  2. It allows for files to be uploaded to the server.

As a general rule, you should use post unless you want the user to be able to bookmark or share (e.g, via email) the resulting web page.

Files can be uploaded to the server via the file input type. The tag syntax is: <input type="file" name="filename">