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 | ![]() |
- 1. XHTML MP (XHTML Mobile Profile) Introduction
- 2. Development of Wireless Markup Languages
- 3. Advantages of XHTML MP
- 4. WML Features Lost in XHTML MP
- 5. Syntax Rules of XHTML MP
- 6. XHTML MP MIME Types and File Extension
- 7. XHTML MP Document Structure
- 8. XHTML MP Generic Metadata
- 9. Comments in XHTML MP
- 10. Line Breaking in XHTML MP
- 11. XHTML MP Horizontal Rules
- 12. XHTML MP Headings
- 13. Font Style in XHTML MP
- 14. XHTML MP Preformatted Text
- 15. XHTML MP Lists
- 16. XHTML MP Images
- 17. XHTML MP Tables
- 18. Anchor Links in XHTML MP
- 19. XHTML MP Selection Lists
- 20. XHTML MP Input Elements
- 21. Submitting Form Data to the Server in XHTML MP