Try the code below...
if ($vSalutation)
{
$arr_criteria{"salutation"} = $vSalutation;
print "<TR>\n";
print "<TD><SPAN CLASS=\"menubold\">Salutation:</SPAN></TD>";
print "<TD> $vSalutation </TD>\n";
print "</TR>\n";
}
if ($vNameL)
{
$arr_criteria{"last_name"} = $vNameL;
print "<TR>\n";
print "<TD><SPAN CLASS=\"menubold\">Last Name:</SPAN></TD>";
print "<TD> $vNameL </TD>\n";
print "</TR>\n";
}
-----Original Message-----
From: Bradshaw, Brian [mailto:[EMAIL PROTECTED]]
Sent: 17 September 2001 15:44
To: [EMAIL PROTECTED]
Subject: hash assignment question
Hi List,
I am trying to assign key/value pairs to a hash based on whether a variable
from an HTML form has a value or not.
I have the code:
if ($vSalutation)
{
%arr_criteria = ("salutation" => $vSalutation);
print "<TR>\n";
print "<TD><SPAN CLASS=\"menubold\">Salutation:</SPAN></TD>";
print "<TD> $vSalutation </TD>\n";
print "</TR>\n";
}
if ($vNameL)
{
%arr_criteria = ("last_name" => $vNameL);
print "<TR>\n";
print "<TD><SPAN CLASS=\"menubold\">Last Name:</SPAN></TD>";
print "<TD> $vNameL </TD>\n";
print "</TR>\n";
}
The assignment to %arr_criteria is working. However I have not found the
method that will let me add a key/value pair instead of overwriting the
existing one. I always have only 1 hash key afte this code is executed. Can
I assign pairs to a hash on the fly, or do I need to find a different way to
do it?
Help? Please? Thanks.
Brian
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------Confidentiality--------------------------.
This E-mail is confidential. It should not be read, copied, disclosed or
used by any person other than the intended recipient. Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful. If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]