He who reads, sometimes writes.
Join Date: Sep 2001
Location: at the keyboard
Posts: 791
|
#!/usr/bin/perl -w
use CGI qw(:standard *table *font);
use strict;
my @params;
my $param;
sub first {
print header, start_html('test'),"\n",start_form,
textfield(-name=>'testvar1', -size=>20),
submit(-name=>'status', -value=>'Second'), "\n",br,
end_form(), end_html();
}
sub second {
print header, start_html('test 2'),"\n", start_form,
textfield(-name=>'testvar2', -size=>20),
submit(-name=>'status', -value=>'Third'),"\n",br,
@params;
foreach $param (@params){
print br,$param, "-", param($param),"\n";}
end_form(), end_html();
}
sub third {
print header, start_html('test 3'),"\n",
@params;
foreach $param (@params){
print br,$param, "-", param($param),"\n";}
print end_html;
}
@params=param;
first() unless param('status');
if (param('status') =~ "Second") {second();}
if (param('status') =~ "Third") {third();}
What I'm trying to do is preserve the variables and their values between these different functions. When I move from function 1 to function2, I keep one value, but from 2 to 3, I lose it but retain the second variable. If you have the ability to plug this into your CGI directory, you'll probably understand, otherwise it might not make much sense.
If you aren't clear about what I'm trying to accomplish here, let me know, and I'll explain it in detail.
Thanks for any help.
|