Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: print output

by arturo (Vicar)
on Jun 26, 2001 at 21:14 UTC ( [id://91666]=note: print w/replies, xml ) Need Help??


in reply to Help with CGI.pm's Table commands

This is an HTML output problem. The key is in those uses you make of CGI.pm's HTML generation methods. What you want presumably (I'm assuming you have one row of data in your example), is a table with each column's label on the top (in the first row of that column) and each subsequent row containing the value for that entry. Here's how the HTML should look:

<tr> <td>Game Name</td> <td>Online Players</td> <td>Avg. Time</td> </tr> <tr> <td>Star Wars</td> <td>blah</td> <td>blah</td> </tr>

Without knowing what %dvalue holds, I'd guess that the 'offending' lines are

print $query->Tr($query->td([$var])); print $query->Tr($query->td(["$dvalue{$var} $dname{$var}"]));

In both cases, you're passing td an anonymous array holding a single value ($var in the first, a concatenation of two hash values in the second). That will print out a single td tag in both cases; and since you've got those wrapped in Tr calls, those end up on two different rows.

What you're getting, in other words is

<tr> <td> ( value of $var )</td> </tr> <tr> <td>(values of the two hash entries )</td> </tr>

You need to work to understand how these functions work, how that code translates to HTML ( or maybe you need to understand more HTML ).

Finally, just because CGI.pm *can* generate HTML doesn't mean you *need* to use it to =) Look into doing things by hand a bit, it may help out here.

perl -e 'print "How sweet does a rose smell? "; chomp ($n = <STDIN>); +$rose = "smells sweet to degree $n"; *other_name = *rose; print "$oth +er_name\n"'

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://91666]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (1)
As of 2024-04-25 03:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found