PHP textarea help - Printable Version -Shoutbox (https://shoutbox.menthix.net) +-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58) +--- Forum: Skype & Technology (/forumdisplay.php?fid=9) +---- Forum: Tech Talk (/forumdisplay.php?fid=17) +----- Thread: PHP textarea help (/showthread.php?tid=53102) PHP textarea help by Ezra on 11-19-2005 at 03:43 PM
I have a textarea en I want to add the inputted text into a database and after that display it on a website, but the formatting like {ENTER} gets lost, how can I change the {ENTER} to a <br> to save the formatting? RE: PHP textarea help by -dt- on 11-19-2005 at 03:57 PM
do something like code: and it should turn all newlines into <br>'s RE: PHP textarea help by L. Coyote on 11-19-2005 at 04:04 PM
quote:Why not use PHP's nl2br() function? RE: PHP textarea help by -dt- on 11-19-2005 at 04:18 PM
quote:because as it says "Inserts HTML line breaks before all newlines in a string" , keeping the new lines is just blah replacing them is alot better RE: PHP textarea help by L. Coyote on 11-19-2005 at 05:48 PM
If you view the source code, keeping \n can be useful. RE: PHP textarea help by Ezra on 11-19-2005 at 08:36 PM thnx , I used -dt-'s code, so I can change them back If I want to put it into a textarea again RE: PHP textarea help by -dt- on 11-20-2005 at 01:16 AM
quote:oh thats odd....*looks at quoting code* ah i wasnt escaping the html.... and tis fixed and uploaded... |