21.1. At the Server-side

At the server side, the parameter name will be used to retrieve the form data. You can use your favorite server-side technology to do the processing required by your mobile Internet application. Some examples of server-side technology are ASP, Java Servlet, JSP, Perl and PHP.


21.1.1. ASP Version

Below is the processing.asp file that contains the ASP code for processing the form data submitted from our earlier WML document. What the ASP code does is very simple. It just prints out the form data received. In real WAP applications, the server probably needs to do more complicated processing. For example, storing the form data to a database such as MySQL, PostgreSQL, Microsoft SQL Server, Oracle Database, etc.

Remember to set the MIME type of the document to "text/vnd.wap.wml".


(processing.asp)

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd">

<% Response.ContentType = "text/vnd.wap.wml" %>

<wml>
  <card id="card1" title="WML Form">
    <p>
      Data received at the server:<br/>
      Name: <% =Request.QueryString("name") %><br/>
      Gender: <% =Request.QueryString("gender") %><br/>
      Which part of our WML tutorial do you like?
      <% =Request.QueryString("tutorial_part") %><br/>
      temp_id: <% =Request.QueryString("temp_id") %>
    </p>
  </card>
</wml>


Let's say you enter "Andrew" in the input field, select the "I am a boy" option in the first selection list, select the "Part 1" and "Part 2" options in the second selection list and click the "Submit Data" link. The screenshots below show what you should see in some mobile phone browsers:






Sony Ericsson T610





Sony Ericsson T68i





Nokia Mobile Browser 4.0


21.1.2. JSP Version

Below is the JSP version that produces the same result as the above ASP code:


(processing.jsp)

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd">

<% response.setContentType("text/vnd.wap.wml"); %>

<wml>
  <card id="card1" title="WML Form">
    <p>
      Data received at the server:<br/>
      Name: <%= request.getParameter("name") %><br/>
      Gender: <%= request.getParameter("gender") %><br/>
      Which part of our WML tutorial do you like?
      <%= request.getParameter("tutorial_part") %><br/>
      temp_id: <%= request.getParameter("temp_id") %>
    </p>
  </card>
</wml>


21.1.3. PHP Version

And here is the PHP version:


(processing.php)

<?php header('Content-type: text/vnd.wap.wml'); ?>
<?php echo '<?xml version="1.0"?'.'>'; ?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd">

<wml>
  <card id="card1" title="WML Form">
    <p>
      Data received at the server:<br/>
      Name: <?php echo $_GET["name"]; ?><br/>
      Gender: <?php echo $_GET["gender"]; ?><br/>
      Which part of our WML tutorial do you like?
      <?php echo $_GET["tutorial_part"]; ?><br/>
      temp_id: <?php echo $_GET["temp_id"]; ?>
    </p>
  </card>
</wml>


Previous Page Page 47 of 50 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