Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #7499

Re: Order of Echoed HTML Output

From Denis McMahon <denismfmcmahon@gmail.com>
Newsgroups comp.lang.php
Subject Re: Order of Echoed HTML Output
Date 2012-11-08 01:14 +0000
Organization A noiseless patient Spider
Message-ID <k7f116$4bh$1@dont-email.me> (permalink)
References <2e1af12b-a4a3-4b77-9bc4-2e790a9a6270@googlegroups.com>

Show all headers | View raw


On Wed, 07 Nov 2012 10:04:23 -0800, bobgatski wrote:

> 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?

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

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Order of Echoed HTML Output bobgatski@gmail.com - 2012-11-07 10:04 -0800
  Re: Order of Echoed HTML Output Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-11-07 14:32 -0500
    Re: Order of Echoed HTML Output The Natural Philosopher <tnp@invalid.invalid> - 2012-11-07 20:39 +0000
  Re: Order of Echoed HTML Output The Natural Philosopher <tnp@invalid.invalid> - 2012-11-07 20:38 +0000
  Re: Order of Echoed HTML Output Denis McMahon <denismfmcmahon@gmail.com> - 2012-11-08 01:14 +0000
    Re: Order of Echoed HTML Output Doug Miller <doug_at_milmac_dot_com@example.com> - 2012-11-08 19:06 +0000
  Re: Order of Echoed HTML Output bobgatski@gmail.com - 2012-11-08 10:14 -0800
    Re: Order of Echoed HTML Output Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-11-08 14:01 -0500

csiph-web