asp.net.ph

Skip Navigation Links

METHOD Attribute | method Property

Language References


Sets or retrieves how the form data should be sent to the server.

Syntax


Inline <FORM METHOD = 'get' | 'post'...>
Script form.method = sMethod ]

Possible Values


get Append the arguments to the action URL and open it as if it were an anchor.
post Send the data through an HTTP post transaction.

The property is read/write with no default value.

Remarks

The method attribute specifies the HTTP method used to send the form to the processing agent. This attribute may take two values: GET and POST.

With the GET method, the form data set is appended to the URI specified by the action attribute ( with a question-mark ( "?" ) as separator ) and this new URI is sent to the processing agent.

With the POST method, the form data set is included in the body of the form and sent to the processing agent.

GET is typically used when the submitted form data does not matter even if seen, as in search forms, which make ideal applications for the method.

The POST method is generally used when the submitted data will effect changes to the destination, such as if the data set modifies a database.

Notes on the GET Method

The GET method has been deprecated due to security considerations, as the form data is visible in the document location. The method is useful, though, for debugging transactions because the submission string is seen as a part of the destination path.

The GET method restricts form data set values to ASCII characters, and limits the amount of data to 256 characters.

Notes on the POST Method

POST can be specified with the enctype="multipart/form-data" attribute to cover the entire ISO10646 character set, which is useful when attaching files with the form data set, or in data using extended characters.

POST is not limited in size, and is the preferred method for transmitting data that must be secure.

If the service associated with the processing of a form causes side effects, for example, if the form modifies a database or subscription to a service, the POST method should be used.

Applies To

FORM

See Also

action, Form Content Types



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note