XHTML MP Form Element

Preferences - Do not show ads

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.


Page 34 of 36 Previous Page | Next Page
Contents at a Glance
Print this Web Page | | Back to Top

Feedback Form (Expand)

What do you think about this web page?






XHTML MP Tutorial Table of Contents XHTML MP Tutorial Contents at a Glance Preferences - Change Color Scheme Preferences - Do Not Show Ads Previous Page Next Page