Hello Monks,

I have been stucked trying to align the rows in my
Perl-generated table for a few days now and can not seem
to find an appropriate solution so I am hoping you could
help me out. Since the number of columns and rows are
dynamically generated based on the user's input, it becomes
more apparent as more rows are created. Please take
a look and give me any suggestion that you may have.
Thanks.
This is my HTML code that call the perl script:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> <html> <head> </head> <body TEXT="#00325D"> <form method="post" action="/cgi-bin/test.cgi"> <br> <br> <b>Number of Tests to Run:</b><input type="text" name="Run" size="5" v +alue="3"><br> <b>Number of Enterprise User Groups:</b><input type="text" name="Group +s" size="5"i value="2"><br> <br><input type="Submit" name="Next" value="Next"></pre> </form> </body> </html>


This is the Perl script:

#!/usr/bin/perl use HTML::Template; use CGI qw(:standard); use CGI::Carp qw(warningsToBrowser fatalsToBrowser); my $run = param('Run'); my $group = param('Groups'); $| = 1; $data_path = "/var/www/html/cgi_data/"; $html_root = "/"; $cgi_root = "/cgi-bin"; @alpha = ('A' .. 'Z'); print "Content-type: text/html\n\n"; print "<html>"; print "<head>"; print "</head>"; print '<body TEXT="#00325D">'; print '<form method="post" action="/cgi-bin/test.cgi">'; print "<br>"; print '<FONT face="Courier New">'; print '<table border="1">'; print '<col width="430"></col>'; my $i = 0; while ($i < $run) { print '<col width="170"></col>'; $i++; } print '<tr><th align="left"><b>&nbsp Test file name:</b>&nbsp<input ty +pe="text" name="Name" size="25" value="H2.Test"></th>'; my $i = 0; while ($i < $run) { $i++; print qq{<th BGCOLOR="#FF0000"><FONT COLOR="FFFFFF">Test $i</font>< +/th>}; } print "</tr>"; print qq{<tr><td rowspan="3" valign="top" align="left"><b>&nbsp Vault +to Stress Test</b><br>&nbsp&nbsp&nbsp Name<br>&nbsp&nbsp&nbsp Max mem +ory for JVM</td>}; my $i = 0; while ($i < $run) { $i++; print '<td align="center"><br><input type="text" name="mem1" size="15 +"><br><input type="text" name="mem1" size="15"></td>'; } print "<tr></tr>"; print "<tr></tr>"; $rowsp = 1 + $group*4; my $i = 0; my $j = 0; print qq{<tr valign=top><td rowspan="$rowsp" align="left"><table borde +r="1"><col width="425"><tr><td><b>&nbsp Virtual User Analysis Engine< +/b> </td></tr><tr><td><br></td></tr>}; while ($j < $group) { my $temp = $alpha[$j]; $j++; print qq{<tr><td>&nbsp&nbsp&nbsp Enterprise Group $temp users</td> +</tr><tr><td>&nbsp&nbsp&nbsp&nbsp&nbsp Average requests/min</td></tr> +<tr ><td>&nbsp&nbsp&nbsp&nbsp&nbsp Average number fields/request</td></tr> +<tr><td>&nbsp&nbsp&nbsp&nbsp&nbsp % read/write/update</td></tr>}; print "<tr><td><br></td></tr>"; } print qq{<tr><td>&nbsp&nbsp&nbsp Excel Users</td></tr><tr><td>&nbsp +&nbsp&nbsp&nbsp&nbsp Excel files opened/hour</td></tr><tr><td>&nbsp&n +bsp &nbsp&nbsp&nbsp Protected cell: average number/file</td></tr><tr><td>& +nbsp&nbsp&nbsp&nbsp&nbsp % added/changed when saved</td></tr>}; #print "<tr><td><br></td></tr>"; #print "<tr><td><br></td></tr>"; print "</table>"; print "</td>"; while ($i < $run) { $i++; print qq{<td rowspan="$rowsp"><table border="1"><col width="165"> +<tr><td><br></td></tr>}; my $j = 0; while ($j <= $group) { $j++; print "<tr><td><br></td></tr>"; print "<tr><td><br></td></tr>"; print '<tr align="center"><td><input type="text" name="test1" + size="15"></td></tr><tr align="center"><td><input type="text" name=" +mem 1" size="15"></td></tr><tr align="center"><td><input type="text" name= +"mem1" size="15"></td></tr>'; } print "</table></td>"; } my $i = 0; while ($i < ($group * 4)) { $i++; print qq{<td rowspan="$rowsp"><table border="1"><col width="165"> +<tr><td><br></td></tr>}; my $j = 0; while ($j <= $group) { $j++; print "<tr><td><br></td></tr>"; print "<tr><td><br></td></tr>"; print '<tr align="center"><td><input type="text" name="test1" + size="15"></td></tr><tr align="center"><td><input type="text" name=" +mem 1" size="15"></td></tr><tr align="center"><td><input type="text" name= +"mem1" size="15"></td></tr>'; } print "</table></td>"; } my $i = 0; while ($i < ($group * 4)) { $i++; print "<tr></tr>"; } print '<tr><td align="left"><b>&nbsp Run TPD Stress Test For:</b></td> +'; my $i = 0; while ($i < $run) { $i++; print qq{<td><center><input type="text" name="mem1" size="15"></cen +ter></td>}; } print "</tr>"; print "</table>"; print "</font"; print "</form>"; print "</body>"; print "</html>";

In reply to Perl/Html Question - rows are not aligned between different columns by Anonymous Monk

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.