Page 1 of 1

[fixed]medium text inquiry[fixed]

Posted: Wed Nov 22, 2006 10:15 am
by Obadiah
i created a feild in my database called 'comment' that stores the information from a textarea field called comments and later allows me to display it....but i was wondering this

right now the comment feild just displays whatever is in the comment field in a straight line...is there a way to set it up to read that the user has began a new line by hitting the enter or return button and displaying it the same way the user entered it

to sum up my poor excuse for a understandable question:

if a user enters this in the textarea:
hello this is a test to make sure the loop is
working correctly now.

it is!
instead of it showing up like this (which it does now):
hello this is a test to make sure the loop is working correctly now. it is!
it shows up like this:
hello this is a test to make sure the loop is
working correctly now.

it is!

Posted: Wed Nov 22, 2006 10:30 am
by JayBird
when outputting the data, use something like nl2br()

Posted: Wed Nov 22, 2006 11:01 am
by Obadiah
so instead of just echoing the comment like i have now

Code: Select all

echo "$comment";
i do something like this?

Code: Select all

echo "nl2br("$comment");
is that right?

or do i implement nl2br when im inputting it in the database?

Posted: Wed Nov 22, 2006 11:20 am
by Obadiah
thanks my answer was

Code: Select all

echo nl2br("$comments");