I need to have one field in the record be a link to a long version of that record. I'm having a problem creating a link if the $field = CompanyName. Here is a sample of my code:
sub build_html_record {
# --------------------------------------------------------
# Builds a record based on the config information.
#
my (%rec) = @_;
my ($output, $field);
my ($thisfield);
$output = "<tr>";
foreach $field (@db_cols) {
next if (($db_form_len{$field} == -1) or ($db_form_len{$field} == -2));
if ($field == 'CompanyName') {
$output .= qq~<td align=center><a href="$db_script_link_url&view_details=1&ID=$rec{'ID'}"><$font>$rec{$field}</font></a></td>
~;
}
else {
$output .= qq~<td align=center><$font>$rec{$field}</font></td>
~;
}
# $output .= qq~<tr><td align=right valign=top width=20%><$font>$field:</font></td>
# <td width=80%><$font>$rec{$field}</font></td></tr>
# ~;
}
$output .= "</tr>\n";
return $output;
}
It makes every record a link instead of just the CompanyName record. Any advice?
Thanks,
Rick Guyer
sub build_html_record {
# --------------------------------------------------------
# Builds a record based on the config information.
#
my (%rec) = @_;
my ($output, $field);
my ($thisfield);
$output = "<tr>";
foreach $field (@db_cols) {
next if (($db_form_len{$field} == -1) or ($db_form_len{$field} == -2));
if ($field == 'CompanyName') {
$output .= qq~<td align=center><a href="$db_script_link_url&view_details=1&ID=$rec{'ID'}"><$font>$rec{$field}</font></a></td>
~;
}
else {
$output .= qq~<td align=center><$font>$rec{$field}</font></td>
~;
}
# $output .= qq~<tr><td align=right valign=top width=20%><$font>$field:</font></td>
# <td width=80%><$font>$rec{$field}</font></td></tr>
# ~;
}
$output .= "</tr>\n";
return $output;
}
It makes every record a link instead of just the CompanyName record. Any advice?
Thanks,
Rick Guyer