Dear Monks,

I need to create a HTML table (within a CGI script) where I define a header fields and then read some variables from a file ("|" delimited) to populate it. I've done it in a following way :

my @Head = ("Anv. ID", "F\xF6r", "Efter", "Pref", "Bef", "Nytt", "Pr", + "F\xF6r", "Kap"); open (TEMP, "<$tempfil") or die "Kan inte \xF6ppna filen $tempfil"; print $qry->start_form(-action => "http://skinnmaskin/cgi-bin/kon.cgi" +); print $qry->table ({ Border => 1, Cellpadding => 5, bordercolor =>"#FF +FFFF"}, map {Tr(th($_) )} \@Head); while (<TEMP>) { my ($Uid, $Fn, $En, $Pr, $Ank, $Ext, $Or, $Adr) = split /\|/, $_ ; print $qry->table({ Border => 1, Cellpadding => 5, bordercolor =>" +#FFFFFF"}, Tr( td(textfield('UID', "$Uid",6)), td(textfield('FNA', "$Fn",20)), td(textfield('ENA', "$En",35)), td(textfield('PRE', "$Pr",10)), td(textfield('BEF', "$Ext",16)), td(textfield('NYTT', "$Ank",5)), td(checkbox('')), td(checkbox('')), td(checkbox('')) ) ) ; }
The problem is that I get a table with a header row which does not fit other columns. Now I've thought of using line counter for a file and unless or until or some other alternatives, but I can't get it work ! Can you please help ? Thanks in advance.


In reply to HTML table creation by SerZKO

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.