Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Order of Echoed HTML Output

5 views
Skip to first unread message

bobg...@gmail.com

unread,
Nov 7, 2012, 1:04:23 PM11/7/12
to
I have this code in a simple php file ...

$which_table_to_dump = "Publisher_Records";
require ('table2html-i-withbuttons.php');

echo "<br/>back from table2html-i-withbuttons.php<br/>";

... The file, table2html-i-withbuttons.php (an earlier version was called 'dumptable'), simply outputs, using echo, the right html table tags, and data from the table, to display the table (specified by the variable $which_table_to_dump.

My confusion and problem is that the echo ("back from ...") appears in the browser window ABOVE the table!

Can anyone explain why that is?

Thanks, Bob

Daniel Pitts

unread,
Nov 7, 2012, 2:32:19 PM11/7/12
to
If a <table> isn't properly closed, then it all bets are off. You can
view-source to verify that your "back from" happens in the right place.
Then you simply have to fix the HTML in your table2html-i-withbuttons.php"

The Natural Philosopher

unread,
Nov 7, 2012, 3:38:45 PM11/7/12
to
cos your HTML is corrupt. Always view source as a first thing.

> Thanks, Bob
>


--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.

The Natural Philosopher

unread,
Nov 7, 2012, 3:39:01 PM11/7/12
to
+1

Denis McMahon

unread,
Nov 7, 2012, 8:14:14 PM11/7/12
to
The only place inside a table that content can appear is inside a cell
within the table (ie inside a td or th).

If you're outputting text outside of the cells but inside the table
structure, then the browser will try and interpret your misplaced text
according to the whims of whoever coded it.

Use the "view source" option of the web browser to see what html is
actually being generated.

Save the following (invalid) html as a file and open it in your browser
if you want to investigate the whims of the coders of your browser.

<html>
<head>
<title>Broken Table</title>
</head>
<body>
<table>
text before the rows
<tr>
text before the header cells
<th>header cell 1</th>
text between the header cells
<th>header cell 2</th>
text after the header cells
</tr>
text between the rows
<tr>
text before the cells
<th>cell 1</th>
text between the cells
<th>cell 2</th>
text after the cells
</tr>
text after the rows
</table>
</body>
</html>

In my firefox, all the wrongly positioned text is concatenated with
intervening whitespace into a single text node prior to the table.

Rgds

Denis McMahon

bobg...@gmail.com

unread,
Nov 8, 2012, 1:14:47 PM11/8/12
to
Thank you VERY much to the several responders. I guess I shouldn't be surprised that my html was messed up. I was surprised that a fairly innocent mistake could result in out of order output.

Thanks again, I appreciate your help.

Bob

Daniel Pitts

unread,
Nov 8, 2012, 2:01:16 PM11/8/12
to
Tables are the only place I've seen this, but I have seen it several
times, so that's why I will always suspect that first when I see
"out-of-order" output. This will probably be true for you now too :-)

Doug Miller

unread,
Nov 8, 2012, 2:06:22 PM11/8/12
to
Denis McMahon <denismf...@gmail.com> wrote in news:k7f116$4bh$1@dont-
email.me:

[...]
> In my firefox, all the wrongly positioned text is concatenated with
> intervening whitespace into a single text node prior to the table.

Likewise in Safari and Opera.
0 new messages