kent12 Posted January 23, 2014 Share Posted January 23, 2014 Form output: Description: vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv textarea coding on input form: <textarea rows="10" name="description" cols="70"><?php echo set_value('description'); ?></textarea><br> coding on output: <td class="dt2 dt0"><?php echo $this->lang->line('Description');?>:</td> <td class="dt2"><?php echo nl2br($project->description); ?></td> How can I get the line breaks in the output? Your help would be appreciated. Thanks Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted January 23, 2014 Share Posted January 23, 2014 (edited) How can I get the line breaks in the output? Your code should already do this. That is what nl2br does It wont, however insert line breaks where continuous text hits the boundaries of a textarea. For example your series of v's will appear as the following in the textarea vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv vvvvvvvvvv There is no line break being inserted for the second line, it is the browser forcing the text to next line. The text will be submitted as one long line (exactly as it was typed). A line break will only be submitted when the user presses the enter key. If you want limit text to exactly 70 chars per line, then use wordwrap before nl2br Edited January 23, 2014 by Ch0cu3r Quote Link to comment Share on other sites More sharing options...
dalecosp Posted January 23, 2014 Share Posted January 23, 2014 Well, you assume that the user will be giving you some sort of help with this, then? Because it could be they type it in without ever hitting return. I suppose you could look at wordwrap()... 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.