"Debbie McNerney" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

If all you need is to see if the field is empty, wrap the prints in if()
conditionals:

if ( $query->param('CustName') ) { print OUT ("\nCustomer Name: "); }
if ( $query->param('CustName') ) { print OUT $query->param('CustName'); }
if ( $query->param('CustName') ) { print OUT ("\n "); }
if ( $query->param('JobDesc') )    { print OUT ("\nJob Description or Ad
Number: "); }
if ( $query->param('JobDesc') )    { print OUT $query->param('JobDesc'); }
if ( $query->param('JobDesc') )    { print OUT ("\n "); }
if ( $query->param('Pubdate') )     { print OUT ("\nPublication Date: "); }
if ( $query->param('Pubdate') )     { print OUT $query->param('Pubdate'); }
if ( $query->param('Pubdate') )     { print OUT ("\n "); }

there are ways that are (much, much) cleaner than this, but it fits in well
with the code you already have.

I would make a hash of known input fields as keys and printable labels as
the values.

my(%input) = (
    'CustName' => 'Customer Name',
    'JobDesc'    => 'Job Description or Ad Number',
    'Pubdate'     => 'Publication Date',
);

make an array containing input field names. This is so you have control of
the order. You dont know the order of the elements when you call keys() on
the hash. This is how I like to do it, but there are cleaner ways, like
using a module that gives you hashes that keep thier order.

my(@input) = qw/CustName JobDesc Pubdate/;

Loop over the elements in the @input array and do a truth test on the
current input field name. If it returns true, print out the report info.

for my $fieldName (@input) {
  if ( $query->param( $fieldName ) {  # this one is not empty
    print OUT $input{$fieldName}, ': ', $query->param( $fieldName ), "\n\n";
  }
}

If this dosent make sense, thats okay, just use the first method I showed.
This was just to show you and others a more extensible, cleaner solution.

Todd W
[EMAIL PROTECTED]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to