If the user doesn't select a county in the first place,  $query->param('County') will 
be undefined, which means that $counties{$query->param('County')}->{County} will be an 
error. So I think I need some code to handle this  using something like 
if($query->param('County'){}
I'm just stuck.
 "Hanson, Rob" wrote:> ...only the categories for which they have a value

This is probably the easiest way.

# this will set the value to '' if the key doesn't exist
my $email_county = $counties{$query->param('County')}->{County} || '';

> And how do I wrap this so the user will select a county

I'm not sure I understand this one. Can you explain what you mean?

Rob


-----Original Message-----
From: Gregg O'Donnell [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 14, 2002 2:43 PM
To: [EMAIL PROTECTED]
Subject: Hash, query->param help

I'm writing a script to send emails to different locations. Some will
receive one email, others 3 or 4. Should each county have all the
categories, even if some have an empty value, or only the categories for
which they have a value. And how do I wrap this so the user will select a
county

my %counties = (
Accomack => { 
Region => '[EMAIL PROTECTED]',
County => '',
Abbrev => 'ACC',
},
Albemarle => {
Region => '[EMAIL PROTECTED]',
County => '[EMAIL PROTECTED]',
Engr => '[EMAIL PROTECTED]',
Abbrev => 'ALB',
},
Alleghany => {
Region => '[EMAIL PROTECTED]',
County => '[EMAIL PROTECTED]',
Abbrev => 'ALL',
);

# Selected County: return EMAIL ADDRESS
my $email_county = $counties{$query->param('County')}->{County};

# Selected County: return REGION EMAIL ADDRESS
my $email_region = $counties{$query->param('County')}->{Region};

# Selected County: return ABBREVIATION
my $county_abbrev = $counties{$query->param('County')}->{Abbrev};

# Selected County: return ENGINEER EMAIL ADDRESS
my $email_engr = $counties{$query->param('County')}->{Engr};

#How do I wrap this so they select a county
my $counties{$query->param('County')}->{County} 
if($query->param('County'){} 

Thanks,
GPO



---------------------------------
Do You Yahoo!?
HotJobs, a Yahoo! service - Search Thousands of New Jobs


---------------------------------
Do You Yahoo!?
HotJobs, a Yahoo! service - Search Thousands of New Jobs

Reply via email to