Yuck....I've been struggling to get error checking to work for a form processing script I am working on. I know I'm overlooking something really stupid but I just can't find it.
I have about 8 field like....
$name = $FORM{name};
$email = $FORM{email};
I would like all the errors listed at once on one page. I have looked at how links does it and tried to modify the code to work for me but can't get it to work - help pleeaaaaaaase :)
This is what I have.....
@required = qw($name $email $address $phone $zip);
foreach (@required) {
if ($_ =~ /^\s*$/) {
push(@bad,"$_ cant be left blank");
}
if ($#bad 1 > 0) {
foreach $error (@bad) {
$errstr .= "<li>$error";
}
&error($errstr);
}
Then in sub error I have...
my ($errstr) = shift;
Shouldn't this work???
Thankyou.
Paul Wilson.
http://www.wiredon.net/gt/
http://www.perlmad.com/
I have about 8 field like....
$name = $FORM{name};
$email = $FORM{email};
I would like all the errors listed at once on one page. I have looked at how links does it and tried to modify the code to work for me but can't get it to work - help pleeaaaaaaase :)
This is what I have.....
@required = qw($name $email $address $phone $zip);
foreach (@required) {
if ($_ =~ /^\s*$/) {
push(@bad,"$_ cant be left blank");
}
if ($#bad 1 > 0) {
foreach $error (@bad) {
$errstr .= "<li>$error";
}
&error($errstr);
}
Then in sub error I have...
my ($errstr) = shift;
Shouldn't this work???
Thankyou.
Paul Wilson.
http://www.wiredon.net/gt/
http://www.perlmad.com/