FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Technical problem... help with this line of code?





Fire Boar
Code:
echo '<tr><td bgcolor=#6699FF colspan=5 align="left"><b>'.$catname.'</b></td></tr>\n';

There's the code. Can anyone tell me what's wrong with it? Yes, I know I'm not using css for this bit, but that's not the issue. You see, instead of making a new line on the browser, it comes out as \n in text. Everything else seems to be working fine, but it's a tad frustrating when there are \n all over the place.

Any help would be greatly appreciated.
Fire Boar
Ah... sorry people, but I've discovered the problem. Apparantly single quotes don't allow \n statements, so I've used this instead:
Code:
echo "<tr><td bgcolor=#6699FF colspan=5 align=\"left\"><b>".$catname."</b></td></tr>\n";
Marston
I think it's wiser to just echo <br />.
BlackSkad
Marston wrote:
I think it's wiser to just echo <br />.

\n and <br /> are not the same. \n will start a new line in your source-code, while <br /> will add a new line in the layout of your page.

An example:
Code:

/**
 * Foo and bar will be on 1 line in the browser, but not in the source-code
 */
echo "foo \n bar";

/**
 * Foo and bar will be shown on 2 lines in the browser, but the source-code will be on 1 line.
 */
echo "foo <br \> bar";
Related topics
How To : Improve Your PHP Programming
Programming Help & Support Guidelines
Webpage Display Problem
[PHP] Error link
problem with html code for video
Problem Help out
need help with this code
CSS a:hover and tables problem. Help really needed?
Whats the problem of my code? Help please
Windows is freer than Linux
Whats the problem with this code
SQL Problem Help
Opera anomaly, Flash Gallery+XML, Problem, HELP?! [SOLVED]
post text not appearing?
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.