Page 1 of 1

echo without linefeed

Posted: Thu Mar 25, 2010 9:17 pm
by smalltowne
I have a simple login script that displays a designated html page when a userid and password are successfully entered. The script uses the echo command to display the page as a variable. My problem is that I believe the echo statement is outputting a line feed before displaying the page, because everything on the page is one line lower than it should be.

$success = file_get_contents('members.htm');
echo $success;


Can anyone provide insight here? Thanks.

Re: echo without linefeed

Posted: Thu Mar 25, 2010 10:07 pm
by JakeJ
Is it possible that the content of $session has a line feed built in to it? I would assume you've already checked that but it doesn't hurt to ask.

If you think one is creeping in somewhere, try using this: http://php.net/manual/en/function.trim.php

Re: echo without linefeed

Posted: Mon Mar 29, 2010 8:21 am
by smalltowne
Sorry I took so long to reply. I was unable to login for a few days until our friendly administrator fixed me up.

I tried trimming, but that had no effect. When I view my page after running the script, it looks like everything has bumped down about 15-20 pixels. That's what made me think it was a linefeed or something. Does anyone have any other ideas? Your help is appreciated by this php newbie.

Re: echo without linefeed

Posted: Mon Mar 29, 2010 11:09 am
by omniuni
Hi,

Line feeds will not be rendered in HTML, only <br/> tags. You can have all the white space you want, and it won't change the layout except for inserting a single space (like the ones between words, it will not register as a line-feed).

I would recommend you use Firefox's web developer toolbar and examine your CSS. See if there is something with a margin that is bumping everything down. If you can provide a link, we can provide more direct feedback.