Home > Archive > PERL Programming > December 2006 > How to select a right item from drop-down list
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to select a right item from drop-down list
|
|
|
| I like to know how to get to the selected item from drop-down list in
perl, below is a portion of the code. A user select an item from
drop-down list & click go, by clicking go the script pick the selectes
item, open data file and replace existing one with selected item .
I have another hidden submit button with different value "value =
some_other_value" and name is "Submit_list", but when I click go button
the other submit button the hidden one takes effect!
So there are two question here:
1- How to use if in the drop-down list ?
2 Why the other submit button takes effect when I click go button?
The other submit button:
print "<TD ALIGN=left><FONT SIZE='1' face='MS Serif'><INPUT TYPE=hidden
NAME=Submit_list VALUE='$path'></BR>\n";
-
-
-
some other code are here
-
-
printf "<SELECT NAME='action'>
<OPTION VALUE=''>-- Make a selection --</OPTION>
<OPTION VALUE='1'>Pass All</OPTION>
<OPTION VALUE='2'>Fail All</OPTION>
<OPTION VALUE='3'>Auto All</OPTION>
</SELECT>";
printf "<INPUT TYPE=submit NAME=Submit_Action VALUE=Go>";
if ( Submit_Action eq "Go" ) {
if (action == 1) {
my $data_file =some data
my $replace = `perl -pi -w -e 's/yes/no/g;' $data_file`;
}
}
| |
| Joe Smith 2006-12-28, 3:58 am |
| Cyrus wrote:
> printf "<SELECT NAME='action'>..."
Perl is not C. When outputing strings without "%" substitution,
the name of the function to use is print().
> printf "<INPUT TYPE=submit NAME=Submit_Action VALUE=Go>";
>
> if ( Submit_Action eq "Go" ) {...}
You've got a conceptual error. There's a big difference between that and
if ($params{'Submit_Action'} eq "Go") {}
or
if (param('Submit_Action') eq "Go") {}
|
|
|
|
|