in reply to Re: CGI problem help
in thread CGI problem help
Thanks for your reply. I did checked again and corrected few things and the table is created now. But I am facing a issue.
I am reading data from a file, processing it and then trying to put the data in table accordingly. Table has 40 rows and 3 columns. Below is the code:
#!C:\perl\bin\perl.exe use strict; use CGI; use CGI qw(:standard); use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use HTML::Table; my $linecount=0; open(FILE,"details.txt")or die("Sorry can't open $!\n"); my $cgi=CGI->new; print $cgi->header; print $cgi->start_html("Test display page"); print $cgi->h3("Testing the output format"); my $table = new HTML::Table(-rows=>40, -cols=>3, -align=>'left', -border=>1, -width=>'30%', -padding=>5, -head=> ['col1','col2','col3']); OUTER: while(my $line = <FILE>) { chomp($line); my @field=split(/\s+/,$line); for(my $j=1;$j<=24;$j++) { $table->setCell($linecount, $j, $field[($j-1)]); } $linecount++; } close(FILE); print $table->getTable; print $cgi->end_html;
It's printing the columns but data's are not coming somehow. When run the code without html it displays the data. Please help to know where I am going wrong.
Thanks, sir_com
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: CGI problem help
by CountZero (Bishop) on Sep 15, 2009 at 18:30 UTC | |
by sir_com (Acolyte) on Sep 16, 2009 at 15:27 UTC | |
by Anonymous Monk on Sep 16, 2009 at 18:22 UTC |