Page 1 of 1

get text exactly as is form text box

Posted: Sun Jan 31, 2010 10:45 am
by jefffan24
I know how to get the text from text boxes but it is not grabbing line breaks so like if somebody type the following in a text box:

a

b

c

d

Right now it comes out as abcd. How can I get the spacing to stay? Also this has to be stored in a mysql database if that makes any difference.

Re: get text exactly as is form text box

Posted: Sun Jan 31, 2010 11:21 am
by AbraCadaver
Use nl2br() that converts the newlines to HTML <br> tags. Depending upon how you want to do this, you can do it before inserting it into the DB or do it when you want to display.

Re: get text exactly as is form text box

Posted: Sun Jan 31, 2010 7:18 pm
by jefffan24
worked perfectly thanks.