You can still use the foreach loop even if you don't want to display all the fields. Depending on how many fields you don't want to display, it might be easier just to name them all. See below for how to just eliminate one field.
The reason your table comes out weird is that you have the line:
print qq|</TABLE>|;
before the call to html_record. You don't want to close the table yet. Move that line to just before
if ($db_next_hits) {
(the bottom one!)
In html_record, just define the rows. Don't put any table tags in them.
Okay, now here's the really hairy part of all this. You will have problems in html_delete_form, html_add_success, html_modify_success -- maybe others.
What I would do is define two displays -- one with the full info and one in the "spreadsheet" format. I'd keep the full info display in html_record, so you wouldn't have to change things in a bunch of subroutines and make a new subroutine called, oh, html_record_spreadsheet. That's the one that would just have table rows.
So, the middle of your html_view_success would be:
print qq|<TABLE WIDTH="475" CELLPADDING=0 CELLSPACING=0 BORDER=1 BGCOLOR="#FFFFCC"><TR>|;
foreach $column (@db_cols) {
unless ($column eq 'Description') {
print qq|<TD><$font_color>$column</FONT></TD>|;
}
}
print qq|</TR>|;
# Go through each hit and convert the array to hash and send to
# html_record for printing.
for (0 .. $numhits - 1) {
&html_record_spreadsheet (&array_to_hash($_, @hits));
}
print qq|</TABLE>|;
sub html_record_spreadsheet {
my (%rec) = @_;
print qq|
<TR>
<TD><$font>$rec{'ID'}</Font></TD>
<TD><$font>$rec{'First_Name'}</Font></TD>
<TD><$font>$rec{'Last_Name'}</Font></TD>
<TD><$font>$rec{'Maiden_Name'}</Font></TD>
<TD><$font><A
HREF="mailto:$rec{'E_Mail_Address'}">$rec{'E_Mail_Address'}</A></Font></TD>
<TD><$font><A HREF="$rec{'URL'}">$rec{'URL'}</A></Font></TD>
<TD><$font>$rec{'Class_of'}</Font></TD>
<TD><$font>$rec{'Address'}</Font></TD>
<TD><$font>$rec{'City'}</Font></TD>
<TD><$font>$rec{'State'}</Font></TD>
<TD><$font>$rec{'Zip'}</Font></TD>
</TR>|;
}
If you have a number of fields you don't want to display, it would be better to substitute the foreach loop with the actual column labels.
Quote:
The descriptions in the table all have <> before them
Do you have a variable called $font_color defined? If you don't, that would account for this problem. Try changing it to just $font.
------------------
JPD