[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]

Re: wml & jsp



On Wed, Feb 14, 2001 at 03:30:58PM +0100, eraldo.vecciarelli@tlsoft.it wrote:
> Hi,
> I would like to make a select element
> with a dynamic number of options elements,
> in other word, the number of options depent, for instance,
> >from the number of string stored in an array of string ...
> 
> I tried to do in the following way, but the compilation
> went wrong
> 
> <% String  str[] = {"aaa","bbb","ccc","ddd"} %>
> <select name="my_select" >
> 
>     <% for(i=0;  i< 5;  i++)  {  %>
>         <option value="" > <%= str[i] %> </option>
>     <% } %>
> 
> </select>

<select name"my_select">
<:
my @str = qw/aa bb cc dd/;
my $i = 0;

while ($i<@str) {
	print "<option>$str[$i]\n";
	$i++;
}:>
</select>

btw it's tested and works
-- 
www.TomK32.de
______________________________________________________________________
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com