Wagner Garcia Campagner wrote:
> 
> Hi,
> I have a script that dysplay a radio button with names of diferent scripts
> on my server...
> (script1.pl; script2.pl; script3.pl,......)
> 
> When a user selects a script and click on the submit button i would like to
> redirect to the selected script but sending some variables too.... i can't
> do that.... i'm thinking about it for days and can't find a solution.....

can you put all your 'scripts' into one file, then call them as methods?

for example:

<form method="post" action="/cgi-bin/script.pl">
<input type="radio" name="action" value="script1"> Script 1
<input type="radio" name="action" value="script2"> Script 2
<br>
Type your name: <input type="text" name="name">
&nbsp;
<input type="submit" value="Submit">
</form>

then have a simple module:

package Script;
use strict;

sub script1 {
  ...do something...
  return some results;
}

sub script2 {
  ...do something else...
  return some results;
}

1;

__END__


then in script.pl:

#!/usr/bin/perl -w
# script.pl
use strict;
use CGI;
use Script;

my $cgi = new CGI;
my $action = $cgi->param('action') || 'script1';

my $results = Script->$action;


etc.  another solution may be to put all the methods in the script.pl
file:

#!/usr/bin/perl -w
# script.pl
use strict;
use CGI;

my $cgi = new CGI;
my $action = $cgi->param('action') || 'script1';

if ($action eq 'script1') {
  ...do something...
}
elsif ($action eq 'script2') {
  ...do something else...
}


etc.  imho, the first example is better.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to