21.1. XHTML MP Form Element

The <form> element is the container of form controls. Notice that in the previous XHTML MP example, the <input> and <select> elements are not enclosed within the <form></form> tag pair directly. There is an intermediate block-level element, <p>, in between. This is necessary for conformance to the XHTML MP standard. We mention about it here since the intermediate block-level element is not necessary in HTML 4.01 Transitional.


<form ...>
  <p>
...
    <input ...>
...
    <select ...>
...
  </p>
</form>


The method attribute of the <form> tag specifies which HTTP method should be used to send the data. Two HTTP methods are available: POST and GET. To use the HTTP POST method, assign the value "post" to the method attribute, otherwise assign "get" to the method attribute.

If the HTTP POST method is used, the data to be sent will be placed in the message body of the request. If the HTTP GET method is used, the data to be sent will be appended to the URL. Since a URL can only contain a limited number of characters, the GET method has the disadvantage that there is a size limit for the data to be sent. If the user data contains non-ASCII characters, you should make use of the POST method to avoid encoding problems.

The action attribute of the <form> tag specifies the URL to send the data to.

In the earlier XHTML MP example, the line

<form method="get" action="processing.asp">

instructs the WAP browser to submit the form to "processing.asp" for processing using the HTTP GET method when the submit button is pressed.


Previous Page Page 34 of 36 Next Page


Feedback Form (ExpandCollapse)

What do you think about this web page?






(Optional) Please provide us more details. For example, suppose you select option 2 above, can you tell us specifically what information is missing? You can also suggest anything that can help us improve this web page.

(Optional) Your name:

(Optional) Your email address:

Please enter again to confirm:

Due to the amount of messages we received, we may not be able to reply to all messages.

A button for going back to the top of this page