I agree with
Russ, don't use a redirect. It is confusing
to users, because they won't know what they did wrong.
I usually just take an array of "required" field names and
loop through it and any that are blank get added to a scalar
that contains an HTML list, like so:
use CGI;
my $q = new CGI;
my $missed;
my @required = qw(name address phone email);
for (@required) {
$missed .= "<li>$_</li>\n" if $q->param($_) eq "";
}
do {
print "Content-type: text/html\n\n";
print qq~
You forgot to fill in the following required fields:
<ul>$missed</ul>
~;
} if $missed;