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.
In reply to Creating Multi-word Options by beginr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |