Textbox Database Storage Problem!

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
bumple
Forum Commoner
Posts: 34
Joined: Thu Jan 08, 2004 4:38 am

Textbox Database Storage Problem!

Post by bumple »

Hi all,

I currently have a blog website I made for fun...

I store users information in databases, but when I want to store a textbox, similar to the one I am filling out right now for this post, in a database, it saves the text without returns...just commonplace, ugly text. Is there any way I can have a dynamic textbox, similar to that on Yahoo! mail, where users can choose to bolden text, italicize, and where the textbox will save the returns in the database, instead of just one straight line?

Thanks in advance!
-BUMPle.
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

The database will have the newlines, you just can't see them. To get them back out of the db and show them on a web page run the text through nl2br() first, Eg echo nl2br($thetext);

If you want all the bold, italics stuff you mentioned then you can either just have the user enter html codes or use a bbcode style textarea, search google for that as i'm sure there's loads around.
Post Reply