Jump to content

Form output is one straight line from textarea


kent12

Recommended Posts

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

Link to comment
Share on other sites

 

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 by Ch0cu3r
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.