in reply to Re: Re: Re: Re: Re: Re: Re: No results from script
in thread No results from script

Hello, :)

The help you gave me earlier was awesome. The script works wonderfully. I have one quick and hopefully easy question for you.

Shouldn't my table data line up underneath my table headings?

My data shifts back and forth from one row to the next. I pasted the code that creates the table. Any ideas on this would be great?

Here it is...
print table ({-border => 0}, Tr ({-align => "CENTER", -valign=>"TOP", -BGCOLOR=>"silver", -st +yle=>"font-family: verdana; font-size: 10pt;"}, th ({-width=>"50"},("Customer ID")), th ({-width=>"50"},("Customer Order")), th ({-width=>"50"},("Purchase Order")), th ({-width=>"90"},("Ship Date")), th ({-width=>"40"},("Carrier")), th ({-width=>"150"},("Tracking Number")), th ({-width=>"60"},("Item Number")), th ({-width=>"50"},("Wt")), th ({-width=>"50"},("Invoice Number")), th ({-width=>"20"},("Qty")), th ({-width=>"50"},("Customer Item Number")) + )); foreach my $row (@$customer) { print table ({-border => 0}, Tr ({-align=>"center", -valign=>"TOP", -style=>"font-family: verda +na; font-size: 10pt;"}, td ({-width=>"60", -align => "center"},(escapeHTML ($row-> +{customer_id}))), td ({-width=>"70", -align => "center"},(escapeHTML ($row-> +{customer_order}))), td ({-width=>"80", -align => "center"},(escapeHTML ($row->{pur +chase_order}))), td ({-width=>"90", -align => "center"},(escapeHTML ($row-> +{ship_date}))), td ({-width=>"40", -align => "center"},(escapeHTML ($row-> +{carrier_id}))), td ({-width=>"175", -align => "center"},(escapeHTML ($row- +>{tracking_number}))), td ({-width=>"45", -align => "center"},(escapeHTML ($row-> +{item_number}))), td ({-width=>"50", -align => "center"},(escapeHTML ($row-> +{weight}))), td ({-width=>"50", -align => "center"},(escapeHTML ($row-> +{invoice_number}))), td ({-width=>"20", -align => "center"},(escapeHTML ($row-> +{quantity_shipped}))), td ({-width=>"50", -align => "center"},(escapeHTML ($row-> +{customer_item_number}))) ));

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Re: Re: Re: Re: No results from script
by edoc (Chaplain) on Jun 04, 2003 at 23:28 UTC

    Pretty sure that's the CGI stuff, which I've never used. If you look in your html I'd guess you've got a table for the header and a separate table for each row. We should be able to drop 'table ...' from the print in the loop and just print the Tr, but I don't know how to prevent CGI from ending the table when we print the header.

    cheers,

    J

Re: Re: Re: Re: Re: Re: Re: Re: Re: No results from script
by edoc (Chaplain) on Jun 05, 2003 at 07:28 UTC

    ok, from another discussion where I got told off for telling fibs..8)

    #!/usr/bin/perl -w use strict; use CGI qw/:standard *table/; print header(), start_html('foo bar qux'), start_table(); print Tr( td('foo'), td('bar'), td('qux') ); print end_table(), end_html();

    so some changes..

    change: use CGI; to: use CGI qw/:standard *table/; change the first: print table ({-border => 0}, to print start_table ({-border => 0}, change in the loop: print table ({-border => 0}, Tr ({-align=>"center", -valign=>"TOP", -style=>"font-family: verda to: print Tr ({-align=>"center", -valign=>"TOP", -style=>"font-family: ver +da and add: print end_table(), after the loop.

    cheers,

    J