WML Submit Data to Server - WML

How to submit data to server in DML?

While users want to submit some information to your server then it will be similar to HTML Form WML will provide a mechanism to submit user data to web server.

To perform this action in WML, you need the <go>...</go> along with <postfield/> tags. The <postfield/> tag should be enclosed in the <go>...</go> tag pair.

You can submit data to a server, by collecting all the set WML variables and use <postfield> elements to send them to the server. The <go>...</go> elements are used to set posting method to either POST or GET and to mention a specific server side script to manage the uploaded data.

We have already discussed about different ways of taking inputs form the users. These input elements sets WML variables to the entered values. Let’s see how to take values from WML variables. See the following example shows how to submit three fields name, age and sex to the server.

Once you download the above code on your WAP device, then it will provide you an option to enter three fields name, age and sex and one link Submit Data. After entering these three fields then select Submit Data link to send entered data to the server.

The method attribute of the <go> tag mentioned about the type of HTTP method to be used to send the form data.

Incase if the HTTP POST method is used, the form data to be sent will be placed in the message body of the request. If you use the HTTP GET method then the form data to be sent will be appended to the URL. However a URL includes a limited number of characters. The GET method has the disadvantage of a size limit to send the data where the user data contains non-ASCII characters, you need to use the POST method to avoid encoding problems.

Let’s find the difference between HTML and WML. In HTML, the name attribute of the <input> and <select> tags is used to define the name of the parameter to be sent, while in WML the name attribute of the <postfield> tag is used to do the same thing. In WML, the name attribute of <input> and <select> is used to mention the name of the variable for storing the form data.

Let’s discuss about how to handle uploaded data at server end in next chapter.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

WML Topics