Cless Posted August 17, 2007 Share Posted August 17, 2007 Hi. Is there a certain way to 'auto-magically' add line breaks when enter is pressed? That way, you don't need to say something like.. This is a message.<br /><br /> Messages are fun! Normally, if you type... This is a message. Messages are fun! It would turn out like this. This is a message. Messages are fun! Thanks! Quote Link to comment Share on other sites More sharing options...
chocopi Posted August 17, 2007 Share Posted August 17, 2007 Im not sure I understand what your on about but i think you might want to check out nl2br ~ Chocopi Quote Link to comment Share on other sites More sharing options...
Cless Posted August 17, 2007 Author Share Posted August 17, 2007 Lol. Like, when you're posting a new topic here. They made it so < br /> codes are added automatically when you press enter. If you don't have that code, you need to type < br /> for a new line. :S Quote Link to comment Share on other sites More sharing options...
chocopi Posted August 17, 2007 Share Posted August 17, 2007 im assuming you mean that you insert data into a table using a textarea, if that is the case then before you echo the data use nl2br ~ Chocopi Quote Link to comment Share on other sites More sharing options...
Cless Posted August 17, 2007 Author Share Posted August 17, 2007 I see... how exactly would you do that? Like this? echo nl2br($Message); Thanks. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted August 17, 2007 Share Posted August 17, 2007 I see... how exactly would you do that? Like this? echo nl2br($Message); Thanks. Yes that is correct. However if you inserting text submitted from a form into a database don't use nl2br in that sense. Only use nl2br when you get the content out of the database. If you use nl2br when you insert text into a database you may find PHP will duplicate the newlines. Quote Link to comment Share on other sites More sharing options...
Cless Posted August 17, 2007 Author Share Posted August 17, 2007 Ah. I see. Thanks. I'll go try it out. Thanks! It worked! Woot! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.