Thread Auswahlisten aus DB erzeugen (7 answers)
Opened by Ronnie at 2003-10-16 11:20

format_c
 2003-10-16 13:04
#5608 #5608
User since
2003-08-04
1706 Artikel
HausmeisterIn
[Homepage] [default_avatar]
Quote
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
sub html_selection {
print "<select name='Installationen'>\n";
for (sort(keys(%software))) {
if (&is_in($_, @installed)) {
print "<option selected>$software{$_}</option>\n";
} else {
print "<option>$software{$_}</option>\n";
}
}
print "</select>\n";
}

Das kann man ganz elegant mit CGI machen:
Bsp.:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use CGI qw/:all/;
my %software = qw/ldms LanDeskManagement sap SAP_GUI_6.2 notes LotusNotes/;
my @installed = qw/ldms notes/;
my $select = scrolling_list(-name=>'Installationen',
-multiple=>1,
-values=>[sort keys %software],
-default=>[@installed],
-labels=>\%software
);

print $select;
_ _ END _ _
<select name="Installationen" size="3" multiple="multiple">
<option selected="selected" value="ldms">LanDeskManagement</option>
<option selected="selected" value="notes">LotusNotes</option>
<option value="sap">SAP_GUI_6.2</option>
</select>


Gibts noch viel mehr geile Sache in perldoc CGI.
Man muss es nur nutzen ;)

Gruß Alex

View full thread Auswahlisten aus DB erzeugen