Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I need it to look like this where the field will print just once when it has multiple values:First: Oregon First: Neveda Second: California Second: Texas Second: Colorado
Here is my form entries on the html page:First: Oregon Neveda Second: California Texas Colorado
My attempt on the Perl action page:<SELECT NAME="Data_One" Size="6" MULTIPLE> <OPTION>Oregon</OPTION> <OPTION>Neveda</OPTION> <OPTION>Idaho</OPTION> </SELECT> <SELECT NAME="Second_Part" Size="6" MULTIPLE> <OPTION>California</OPTION> <OPTION>Texas</OPTION> <OPTION>Colorado</OPTION> </SELECT>
Please advise.foreach $field (param) { foreach $value (param($field)) { if($field =~ /Data_One/) { $field = "First"; } if($field =~ /Second_Part/) { $field = "Second"; } if($value !~ /^\s*$/) { $allData .= "$field\:\n$value\n\n"; } } } ..... <table align=\"center\" width=520> <tr><td><pre>$allData</pre></td><tr> </table>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Distinct field name output attempt
by polettix (Vicar) on May 16, 2005 at 14:17 UTC | |
|
Re: Distinct field name output attempt
by holli (Abbot) on May 16, 2005 at 14:26 UTC | |
by Anonymous Monk on May 17, 2005 at 15:57 UTC | |
|
Re: Distinct field name output attempt
by mrborisguy (Hermit) on May 16, 2005 at 13:54 UTC |