echo without linefeed

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
smalltowne
Forum Newbie
Posts: 2
Joined: Thu Mar 25, 2010 9:10 pm

echo without linefeed

Post 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.
JakeJ
Forum Regular
Posts: 675
Joined: Thu Dec 10, 2009 6:27 pm

Re: echo without linefeed

Post 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
smalltowne
Forum Newbie
Posts: 2
Joined: Thu Mar 25, 2010 9:10 pm

Re: echo without linefeed

Post 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.
User avatar
omniuni
Forum Regular
Posts: 738
Joined: Tue Jul 15, 2008 10:50 pm
Location: Carolina, USA

Re: echo without linefeed

Post 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.
Post Reply