Hallo!
Multiples SELECT-Feld (Strg),
user selectiert mehrer eintries,
sendet,
und dann wird nach dem senden angezeigt was
er selectiert hat,
aber wieder in der Select-Box.
Das ganze geht mit dem Befehl "map" recht gut,
aber mit "map" stehe ich auf Kriegsfuß,
und will ihn auch daher nicht verwenden.
Und dieses Code hier nenne ich "Code des Wahnsinns"
weil er nicht nur chaotisch ist,
sondern nichtmal funktioniert (grummel)
Wenn wer ne geniale idee hat wie man das lösen kann,
aber bitteschön ohne "map" waere es toll.
LG
Aqua
======================================================
#!/usr/bin/perl
use CGI;
use strict;
my $cgi=CGI->new();
my @all=qw(Pear Banana Peach Cherry Orange Coconut Apple Nut Chocolate Burger Bread Grapefruit);
my @selected = $cgi->param("food");
print "Content-type: text/html\n\n";
print <<'EOF';
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
</head>
<body>
EOF
print '<form action="foo.pl" method="post">';
print '<div>';
print '<select name="food" size="5" multiple>';
my $a;
my $b;
my $c;
my $d;
if($cgi->param("foodform") eq "submit")
{
for(@all)
{
$a=$_;
for(@selected)
{
$b=$_;
if($a eq $b)
{
$c = "1";
}
else
{
$c = "0";
}
}
if($c==1)
{
$d.='<option value="'.$a.'" selected>'.$a.'</option>';
}
else
{
$d.='<option value="'.$a.'">'.$a.'</option>';
}
print $d;
}
}
else
{
for(@all)
{
print '<option value="'.$_.'">'.$_.'</option>';
}
}
print <<'EOF';
</select>
<br>
<input type="submit" value="submit" name="foodform">
</div>
</form>
</body>
</html>
EOF
======================================================