David Gilden wrote:
> Here is what I am trying to do,
<snip>
> $class_to_display = param('kayaking_intro');
> $class_to_display = param('white_water_intro');
> $class_to_display = param('white_water_beyond');
> $class_to_display = param('white_water_rolling');
>
> # The way it is written shouldn't I be assigning 'Class Schedule' to
> # $class_to_display? Not what I want :)
>
> It does not seem to work, what might I be missing?
Since all your submit buttons have all the same value, the behaviour
you're getting is perfectly normal. To do what you want, you can rely
on the fact that only one submit button was pressed. So, all the other
param don't exist.
Here's a possible way to do it:
#!/usr/bin/perl -w
use strict;
use CGI qw(:standard);
my @classes = qw( kayaking_intro white_water_intro
white_water_beyond white_water_rolling );
my $class_to_display;
foreach (@classes){
$class_to_display = $_ and last if defined param($_);
}
die "No class to display\n" unless $class_to_display;
print "Class to display: $class_to_display\n";
__END__
--
briac
<< dynamic .sig on strike, we apologize for the inconvenience >>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]