beginr has asked for the wisdom of the Perl Monks concerning the following question:
I have the following code to produce a drop down.
It has some Options with more than one word ie. "Desktop Products"
but when i am reading the form value using
param('technology');it returns only "Desktop" not "Desktop Products"
Source Code follows
calling the function like this
print "<select name='technology'>"; $tech_selected=param('technology'); &print_option('t',$tech_selected); print "</td></tr>"; sub print_option{ my ($opt,$selected)=@_; my ($arr_val,$where,$ind,$sql); my ($dbh,$sth); if ($opt eq 't'){ # Build Tech Drop down $sql="select distinct(technology) from t_pomap"; }else{ # Build NPO Drop down $sql="select distinct(npo) from t_pomap"; } $dbh = DBI->connect('DBI:Pg:dbname=test', 'db_user', ''); $sth=$dbh->prepare ($sql); $sth->execute(); $ind=0; while(my @options=$sth->fetchrow_array()){ if ($selected eq $options[0]){ print "<option value=$options[0] selected=$options[0]>$options[0] +</option>"; } else { print "<option value=$options[0] >$options[0]</option>"; } }#endwhile $dbh->disconnect(); }#endsub
Edited by davorg: tidied formatting.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Creating Multi-word Options
by davorg (Chancellor) on Sep 12, 2006 at 08:29 UTC | |
|
Re: Creating Multi-word Options
by Jenda (Abbot) on Sep 12, 2006 at 08:08 UTC | |
by davorg (Chancellor) on Sep 12, 2006 at 08:22 UTC | |
|
Re: Creating Multi-word Options
by jdtoronto (Prior) on Sep 12, 2006 at 14:34 UTC |