in reply to How to keep the state of a drop down select box in perl
and on the perl side...<select name="dropdown"> <option>Option 1</option> <option>Option 2</option> <option>Option 3</option> </select>
As I said, I'm sure there are easier approaches to this, but I still do it ye good ol' way...my @dropdown = ('Option 1','Option 2','Option 3'); foreach $op (@dropdown) { if ($op eq $in{'dropdown}) { # I use cgi-lib.pl still... $dropdown .= "<option selected>$op</option>\n"; } else { $dropdown .= "<option>$op</option>\n"; } } # later on insert $dropdown somewhere on you're # HTML response page...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: How to keep the state of a drop down select box in perl
by Adam (Vicar) on Dec 16, 2000 at 00:56 UTC | |
by BBQ (Curate) on Dec 16, 2000 at 13:18 UTC |