Jump to content

echo data from textarea on seperated lines.


Recommended Posts

Hi everyone, just a simple displaying problem.
if I insert information using a textarea

<textarea name="Notes" cols="50" rows="6" class="box"></textarea>

and display information using:

echo $row ['Notes'];

All the data inputed remains on 1 line. Ive tried

echo nl2br ($row ['Notes']);

but think ive got the syntax wrong. Any help with this would be good. thank you
Link to comment
Share on other sites

Yes the following is the correct sytax
[code]echo nl2br ($row ['Notes']); [/code]
But remove the space between $row and ['Notes'] in the above code so it is just:[b]$row['Notes'][/b]

Also I presume you are getting $row['Notes'] from a database? And any data that is submitted from the textarea is added into the database?
Link to comment
Share on other sites

  • 9 months later...
I am having i think the same problem, and trying not to start new topics on same posts.  I have a form inserting data into a mysql database, and on the page where i call the data, a simple tabled list of the data displayed, anything entered in the "textarea" box is displayed as one long sentence instead of displaying where someone typed 'enter' key.  So display is like this:

Jon Smith 554 main Anytown USA 

instead of:

Jon Smith
554 main
Anytown USA

I have tried adding this code, with the space taken out, to my code but it does not seem to work.  Is there more to it i need to do rather than whats shown here on my display page to get it to work correctly?  (i am fairly new to php...)

thanks anyone!
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.