On Wed, 17 Apr 2002 [EMAIL PROTECTED] wrote: > What's the simplest way to make sure that all 10 fields have been > selected? I was hoping that...
A slightly shorter, more elegant solution: #! /usr/bin/perl -w use CGI qw(:standard); use vars qw(%form_fields @missing); %form_fields = ( company_name => 'Company Name', job_id => 'Job ID', job_title => 'Job Title' ); @missing = (); print header(), start_html(); if (missing_params() == 0) { print "All form-fields had values."; } else { print "These form-fields did not have values:", ol(li([@missing])); } print end_html(); sub missing_params { foreach (keys %form_fields) { next if defined param($_); push @missing,$form_fields{$_}; } return scalar(@missing); } -- Eric P. Los Gatos, CA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]