[fixed]medium text inquiry[fixed]

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
User avatar
Obadiah
Forum Regular
Posts: 580
Joined: Mon Jul 31, 2006 9:13 am
Location: Ashland, KY
Contact:

[fixed]medium text inquiry[fixed]

Post 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!
Last edited by Obadiah on Wed Nov 22, 2006 11:21 am, edited 1 time in total.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

when outputting the data, use something like nl2br()
User avatar
Obadiah
Forum Regular
Posts: 580
Joined: Mon Jul 31, 2006 9:13 am
Location: Ashland, KY
Contact:

Post 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?
User avatar
Obadiah
Forum Regular
Posts: 580
Joined: Mon Jul 31, 2006 9:13 am
Location: Ashland, KY
Contact:

Post by Obadiah »

thanks my answer was

Code: Select all

echo nl2br("$comments");
Post Reply