HTML form method Attribute
HTML <form> tag
Definition and Usage
The method attribute specifies method to use to send the form data to the
specified URL.
The form data is sent to the page specified in the action attribute.
Syntax
<form method="send_method">
|
Syntax Example
Attribute Values
Value |
Description |
get |
Default. This method sends the form contents in the URL: URL?name=value&name=value.
Note: If the form values contains non-ASCII characters or
exceeds 100
characters you MUST use method="post". |
post |
This method sends the form contents in the body of the
request. Note: Browsers are
unable to bookmark post requests. |
Browser Support
The attribute is supported in all major browsers.
Tips and Notes
Note: When using the get method, form names and values are displayed
in the URL. So this method should not be used when sending passwords or other
sensitive information!
Example
<form action="demo_form_method.asp" method="get">
First name:
<input type="text" name="FirstName" value="Peter" />
<br />
Last name:
<input type="text" name="LastName" value="Griffin" />
<br />
<input type="submit" value="Submit" />
</form>
|
Try-It-Yourself Demos
form method
attribute example using GET
Send form data with the GET method.
form
method attribute example using POST
Send form data with the POST method.
HTML <form> tag
|
|
|