20.1.2. Using Data Collection Tags <select> and <input/>

Another way to set a value to a variable is to make use of data collection tags <select> and <input/>. Both <select> and <input> contain the name attribute, which specifies the name of the variable you want to assign a value to.

The following WML example shows how to assign a value to a variable using the <select> tag:


<select name="selection_list">
  <option value="tutorial_A">WML Tutorial A</option>
  <option value="tutorial_B">WML Tutorial B</option>
  <option value="tutorial_C">WML Tutorial C</option>
</select>


In the above WML example, the variable associated to the selection list is named as selection_list. If a user selects the first option (i.e. WML Tutorial A), the value attribute value of the first option (i.e. tutorial_A) will be assigned to the selection_list variable.

The following WML example shows how to assign a value to a variable using the <input/> tag:


<input name="myName"/>


The variable associated to the above input field is named as myName. If a user types the word Jack in the input field, the myName variable will contain the value Jack.


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