On Fri, May 6, 2011 at 22:52, Ross Hansen <[email protected]> wrote:
>
> Hey Guys,
>
> I am using a form to post information to a MySQL table which is then
> echo(ing) back out to a web page. it will sort of be like facebook where you
> can post messages and stuff on peoples walls. The only issue is at the moment
> i can get the formatting to stay. When i echo the table out from mysql it all
> gets displayed on one line rather than seeing my new lines which i typed in
> the text box.
> I do know that this is a HTML error as it was never given the format tags
> when the content was posted in the table.
>
> I have seen something about NL2BR and also something about strip slashes but
> i am not sure how to incorporate them into my post.
>
> Could someone please advise?
Well, let's start with an easy question: have you *tried* them?
<?php
// $row = /* Database row grabbed elsewhere in your code. */'';
if (is_array($row)) {
foreach ($row as $r) {
echo nl2br($row).PHP_EOL;
}
} else {
echo nl2br($row).PHP_EOL;
}
?>
Error-handling and the remainder of checking is up to you.
--
</Daniel P. Brown>
Network Infrastructure Manager
http://www.php.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php