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

 

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.