I will attempt this question again, as apparently the last time I asked it, I didn't do it very well... Here goes again:
I have this bit of code, which take parameters from a web form and depending on the input parameter should display text in a textarea.
The if statement that sets the $defMessage variable is running properly, but no matter what the input variables value is, the default text in the textarea doesn't change to the actual value stored in $defMessage.
Can anybody spot why this might be happening?
my $defMessage = undef;
$defMessage = 'CONCAT 1';
if ($templateLength =~ SEND_OPTIONS_CONCAT_1) {
$defMessage = 'CONCAT 1';
} elsif ($templateLength =~ SEND_OPTIONS_CONCAT_2) {
$defMessage = 'CONCAT 2';
} elsif ($templateLength =~ SEND_OPTIONS_CONCAT_3) {
$defMessage = 'CONCAT 3';
}
print $q->start_form(
-name=>'main',
-method=>'POST',
);
print $q->start_table(
{-align=>'center', -border=>1}
);
print $q->Tr(
$q->td(
{-align=>'center'},
'Message<br>'.$q->textarea(
-name=>'sendMessage',
-size=>15,
-rows=>10,
-columns=>15,
-value=>$defMessage,
),
),
);
I have tried changing
my $defMessage = undef;
to
use vars qw($defMessage);
but that didn't work either...
SEND_OPTIONS_CONCAT_1 etc...?