mjd78
New Member
Posts: 3
|
Post by mjd78 on Nov 29, 2012 11:54:30 GMT -5
Hey guys, I am having trouble formatting the data the user inputs into my text area. If the user enters this:
5 rounds: 25 pullups 50 situps
I want it to appear as they wrote it, but when I retrieve it from the database it is showing up on one line like this:
12 rounds: 25 pullups 50 situps
Does anyone know how to format this so it shows up as written? I've been looking it up online and playing with '/n' but haven't been able to figure it out. Basically it is the same as this forum, how each post is formatted to appear just as the user wrote it. Thanks in advance.
|
|
|
Post by Bob P on Nov 29, 2012 15:39:26 GMT -5
Not exactly sure what you are trying to do but look at this: php.net/manual/en/function.nl2br.phpRemember the OS determines how \n, crlf, cr is interpreted. In HTML <br /> causes a line break. \n doesn't do much on Windows but creates line breaks on Unix. Bob
|
|
mjd78
New Member
Posts: 3
|
Post by mjd78 on Nov 29, 2012 15:46:59 GMT -5
Bob, that worked perfectly. I just wrote:
$description = $_POST['description']; $description = nl2br($description);
and it showed up as I wanted it to. Many thanks!
|
|