Herb <patyoun...@hotmail.com> asked:
> I've been working on putting together a multi-page form in a single
> perl script.  I have everything working as a single page form (writing
> to mysql database and emailing the output upon submit) but have not
> had any luck breaking the form into multiple pages.  As mentioned
> before, I'm not an everyday perl programmer so I may be going about
> this whole thing wrong.
> 
> I'm trying to break 20 parameters into 4 pages as:
> 
> if ($param1 eq "") {
> 
> <display page1>
> 
> } elsif ($param6 eq "") {

I'd suggest that you use one CGI parameter for page selection. My personal 
preference is to call it "action" and give it meaningful values, like:

use CGI;
use CGI::Carp qw/fatalsToBrowser/;

my $q = CGI->new();

[...]

my $action = $q->param('action') || '';

if( $action eq "update" ){
  # display update page
} elseif( $action eq "insert" ){
  # display insert data page
} else {
  # display start/login page
}

Using a single "action" parameter avoids ambiguities when deciding which page 
to display.

HTH,
Thomas

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to