21. Submitting Form Data to the Server in XHTML MP

In the previous sections of this XHTML MP tutorial, we have mentioned about how to use selection lists and various input elements to obtain data from a user in XHTML MP. However, the user data has no use if it is not posted to the server for further processing. To post data to the server in XHTML MP, you need the <form></form> tags and a submit button. Let's first have a look at the following XHTML MP example. Then we will go into the details.


(sendDataEg1.xhtml)

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>XHTML MP Tutorial</title>
  </head>

  <body>
    <h1>Registration Form</h1>
    <form method="get" action="processing.asp">
      <p>
        Username:<br/>
        <input name="username"/><br/>

        Password:<br/>
        <input type="password" name="password"/><br/>

        Gender:<br/>
        <input type="radio" name="gender" value="m"/>Male
        <input type="radio" name="gender" value="f"/>Female<br/>

        Country:<br/>
        <select name="country">
          <option value="ca">Canada</option>
          <option value="cn">China</option>
          <option value="fr">France</option>
          <option value="de">Germany</option>
          <option value="in">India</option>
          <option value="it">Italy</option>
          <option value="jp">Japan</option>
          <option value="kr">Korea</option>
          <option value="uk">United Kingdom</option>
          <option value="us">United States</option>
        </select><br/>

        Which part of our XHTML MP tutorial do you like?<br/>
        <input type="checkbox" name="tutorial_part" value="1"/>Part 1
        <input type="checkbox" name="tutorial_part" value="2"/>Part 2
        <input type="checkbox" name="tutorial_part" value="3"/>Part 3
        <input type="checkbox" name="tutorial_part" value="4"/>Part 4

        <input type="hidden" name="temp_id" value="123456"/>
      </p>

      <hr/>

      <p>
        <input type="submit"/>
        <input type="reset"/>
      </p>
    </form>
  </body>
</html>












Sony Ericsson T610











Nokia Mobile Browser 4.0


Previous Page Page 33 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