in reply to How can I send an HTML error message to a user who leaves form fields blank?

There are many ways to accomplish this. Here's one (untested):

#!/usr/bin/perl -wT use strict; use CGI qw/:standard/; my %errors; my ( $candidate ) = ( param( 'candidate' ) =~ /^([\s\w]+)$/ ); # candidate must be defined and have at least one non-whitespace chara +cter if ( ! defined $candidate or $candidate !~ /\S/ ) { $errors{ candidate } = 'You must supply a value for candidate'; } # grab more params and untaint if ( %errors ) { display_page_with_errors( \%errors ); }

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

Replies are listed 'Best First'.
Re: (Ovid) Re: HELP! I need more perl wisdom...Thankyou:!
by Ryszard (Priest) on Nov 30, 2001 at 03:56 UTC
    -T being one of the more important things you can learn doing web stuff.