tbone has asked for the wisdom of the Perl Monks concerning the following question:

Hey Monks, I have written a cgi script that uses HTML::TABLE to create a table from a database. Everything works correctly, however the table does not display with the correct format in Netscape though it works fine in IE. This is a new thing for me dealing with different browsers. If anyone knows anything or has any suggestions, it would be greatly appreaciated. Here is a snibet of my code in creating the table. Thanks again
use HTML::Table; my @headers = ("<b><a href='pastRequests.pl?order=Custodial_Code&Name= +$name'>Custodial Code</a></b>", "<b><a href='pastRequests.pl?order=TIME&Name=$name'>Da +te</a></b>", "<b><a href='pastRequests.pl?order=Requestor_Name&Name +=$name'>Requestor's Name</a></b>", "<b>Requestor's Phone Number</b>", "<b>Contact Name</b +>", "<b>Contact Phone Number</b>", "<b>Building</b>", "<b>Room</b>", "<b>Decal #</b>", "< +b>Descr</b>", "<b>Y2K</b>", "<b>CPU</b>", "<b>LAB</b>" , "<b><a href='pastRequests +.pl?order=Technician&Name=$name'>Tech</b>"); my $table = new HTML::Table(-border=>1); $table->addRow(@headers); my $rows=1; print "<div id='printReady'>"; foreach my $row (@$ary_ref){ if ($rows % 20 == 0){ $table->addRow(@headers);} $table->addRow(@$row); $rows++;} for ( 1 .. $table->getTableRows() ) { $table -> setRowStyle( $_,'font-face=arial; size= 11' ); $table -> setRowAlign( $_,"center");} $table->print;

Replies are listed 'Best First'.
Re: using HTML::TABLE with netscape
by Thelonius (Priest) on May 09, 2003 at 16:27 UTC
    One problem you have is that this:
    Tech</b>");
    should be:
    Tech</a></b>");
    As hardburn says, run your code through a validator to check for errors, although the errors are most likely to be your own, not HTML::Table's.
Re: using HTML::TABLE with netscape
by hardburn (Abbot) on May 09, 2003 at 16:09 UTC

    Run the output against a validator. If it passes, send a bug report to Netscape (for whatever good it would do . . . ). If it doesn't pass, send a bug report to the HTML::Table author.

    ----
    I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
    -- Schemer

    Note: All code is untested, unless otherwise stated

(jeffa) Re: using HTML::TABLE with netscape
by jeffa (Bishop) on May 09, 2003 at 16:52 UTC
    <plug shame="none">
    
    Since you are getting your data from a database, shouldn't you be using DBIx::XHTML_Table instead? ;)
    </plug>
    

    UPDATE: Ya know ... in retrospect, i don't think you should be using any kind of 'HTML::Table' module. Those modules are, IMHO, really meant for simple tables. What you have is not simple at all. Complex tables like this are best handled with a templating solution instead. My favorite just happens to be HTML::Template. Check out HTML::Template Tutorial as well as Dynamic HTML::Template Database Template for some examples. I will admit that understanding HTML::Template is a bit difficult, but once you learn the basics you will be glad you did.

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)