method and action URL


<form method="" action="">

Browser
Internet Explorer Firefox Opera
Type
Block-level

The action attribute of the FORM element defines where to send the form data, and the method attribute specifies the HTTP method for sending the form data.


<form method="POST" action="example.cgi">


Attribute Value Explanation
method=" " POST sent with the POST method
GET sent with the GET method (default)
action=" " URL the form data is sent to this URL

HTTP method

POST
The POST method sends the form data in the body of the HTTP request.
(A large amount of data can be sent.)

GET
The GET method sends the form data within the URL.
http://www.tagindex.net/example.cgi?name1=value1&name2=value2
(There are limits to the number of characters that can be sent.)


Example

<form method="POST" action="example.cgi">

<p>Name<br>
<input type="text" name="Name" size="40"></p>

<p>Comments<br>
<textarea cols="50" rows="5" name="Comment"></textarea></p>

<p><input type="submit" value="Submit"></p>

</form>
Output

Name

Comments

This form cannot submit because of a sample.