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.
Feedback Form ( ExpandCollapse)
|