when a string is saved on the server, how can i retrieve it with the line-breaks still there ? (insert '<br>' where appropriate) :)
Printable View
when a string is saved on the server, how can i retrieve it with the line-breaks still there ? (insert '<br>' where appropriate) :)
Explain more....
if i had to save a string from an html input field, it should just save it as a straight line od\f text. but i want it to be multiple lines like it was when entered in the field.
use the nl2br() function. I believe that should do the trick. Read up on it at http://www.php.net/nl2br/. Never used it though so i cant advise.
thanx pro :)
or you can use this
$textboxreplace("(\r\n|\n|\r)", "<br>", $textbox);
i was initially thinking along those lines scoutt ;)
but didnt you mean:
$textbox = replace("(\r\n|\n|\r)", "<br>", $textbox);
well close. I did mess up though so it should be like this
$textbox = ereg_replace("(\r\n|\n|\r)", "<br>", $textbox);