Link to home
Start Free TrialLog in
Avatar of jamaica
jamaica

asked on

How to not print blank_fields?

I'm trying to set a command that will not print blank fields in my form's emailed results.

Let's say I have my check_email entries. If no value was entered for the field 'Version', I do not want to have the field 'Version' printed out in the email results.

How's the best way to have a no_blank_field_print set in the cgi script?

open CREATE_EMAIL, ">

print CREATE_EMAIL "\nVersion = $in{'Version'}";

print CREATE_EMAIL "\nType = $in{'Type'}\n";

close CREATE_EMAIL
ASKER CERTIFIED SOLUTION
Avatar of Tintin
Tintin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
As Tintin has said above


print CREATE_EMAIL "\nVersion = $in{'Version'}" if ($in{'Version'});

print CREATE_EMAIL "\nType = $in{'Type'}\n" if ($in{'Type'});

Avatar of Tintin
Tintin

I would also point out on a related topic that it appears jamaica is using cgi-lib.

This library is old, outdated and not maintained.

Start using the standard CGI.pm module.
Avatar of jamaica

ASKER

Tintin, thank you!!

Yes, I'm using cgi-lib and will certainly look into upgrading to CGI.pm.