FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Order of Echoed HTML Output
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Order of Echoed HTML Output [message #179561] Wed, 07 November 2012 18:04 Go to next message
bobgatski is currently offline  bobgatski
Messages: 11
Registered: October 2012
Karma: 0
Junior Member
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
Re: Order of Echoed HTML Output [message #179562 is a reply to message #179561] Wed, 07 November 2012 19:32 Go to previous messageGo to next message
Daniel Pitts is currently offline  Daniel Pitts
Messages: 68
Registered: May 2012
Karma: 0
Member
On 11/7/12 1:04 PM, bobgatski(at)gmail(dot)com 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?
>
> Thanks, Bob
>
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"
Re: Order of Echoed HTML Output [message #179563 is a reply to message #179561] Wed, 07 November 2012 20:38 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
On 07/11/12 18:04, bobgatski(at)gmail(dot)com 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?
>

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.
Re: Order of Echoed HTML Output [message #179564 is a reply to message #179562] Wed, 07 November 2012 20:39 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
On 07/11/12 19:32, Daniel Pitts wrote:
> On 11/7/12 1:04 PM, bobgatski(at)gmail(dot)com 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?
>>
>> Thanks, Bob
>>
> 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"
+1


--
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.
Re: Order of Echoed HTML Output [message #179568 is a reply to message #179561] Thu, 08 November 2012 01:14 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
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
Re: Order of Echoed HTML Output [message #179569 is a reply to message #179561] Thu, 08 November 2012 18:14 Go to previous messageGo to next message
bobgatski is currently offline  bobgatski
Messages: 11
Registered: October 2012
Karma: 0
Junior Member
On Wednesday, November 7, 2012 1:04:23 PM UTC-5, bobg...@gmail.com 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?
>
>
>
> Thanks, Bob

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
Re: Order of Echoed HTML Output [message #179570 is a reply to message #179569] Thu, 08 November 2012 19:01 Go to previous messageGo to next message
Daniel Pitts is currently offline  Daniel Pitts
Messages: 68
Registered: May 2012
Karma: 0
Member
On 11/8/12 1:14 PM, bobgatski(at)gmail(dot)com wrote:
> On Wednesday, November 7, 2012 1:04:23 PM UTC-5, bobg...@gmail.com 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?
>>
>>
>>
>> Thanks, Bob
>
> 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.
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 :-)
Re: Order of Echoed HTML Output [message #179571 is a reply to message #179568] Thu, 08 November 2012 19:06 Go to previous message
Doug Miller is currently offline  Doug Miller
Messages: 171
Registered: August 2011
Karma: 0
Senior Member
Denis McMahon <denismfmcmahon(at)gmail(dot)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.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Problem creating XML file
Next Topic: Analista Programador PHP
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 22:57:14 GMT 2024

Total time taken to generate the page: 0.03069 seconds