[SOLVED] Help with HTML formatting text input - n00b

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
wizzy
Forum Newbie
Posts: 3
Joined: Wed Jan 21, 2004 8:01 am

Help with HTML formatting text input - n00b

Post by wizzy »

Hi ppl.

Sorry if this sounds like a dumb request, but Im a bit of a php n00b and am still learning and tweaking scripts as I make them. This is just one little bug bear I have that I would like to solve.

The situation: When a user clicks on a guestbook to make an entry, they fill in the comment box and click submit and it saves it to a mysql DB and is then viewable back at the guestbook homepage

the Problem: If the user puts in several lines of text (ie. has carriage returns at the end of each paragraph/line), then the text all gets saved on to one line... without any formatting. The user actually has to type in his paragraph, followed by 2 < BR > to create a new paragraph.

Solution Needed: What I would like is that what the user types in to the text box is actually whats displayed when they are taken back to the guestbook entries display.

Any help would be appreciated.
wizzy
Forum Newbie
Posts: 3
Joined: Wed Jan 21, 2004 8:01 am

Post by wizzy »

Isnt it amazing how when youve been searching for a solution for a while, so decide to post on a public forum, and then within minutes find the answer you were looking for!?!?

Well, just found what I was after, and it was all in the format of the string nl2br()

Works a treat now, thank you for your time.
Post Reply