Is there any way to change new lines in a text box into <br>?
I need my multi-line text box to translate Enter's into <br>.. Not necessarily as they input into the box, but when the form is processed. I need to keep the message on one line in the storage file.
Make sense? Thanks!
at the danger of not having understood the problem i'd just say
str_replace("\n", "<br />", $text);
Yeah that sounds like it would make sense... How exactly would I do this? I tried a couple things that didn't work This is what I have:
fputs($fw,"$message\n");
I tried just putting it in there, and doing a couple other things...
Thanks!
I've tried all these and none work...
fputs($fw,"str_replace("\n", "<br />", $message); \n"); fputs($fw,'str_replace("\n", "<br />", $message); \n'); fputs($fw,"$message\n"); str_replace("\n", "<br />", $message);
something like this...?
$newMess = str_replace("\n", "<br />", $message); fputs($fw, $newMess."\n");
It does make \n 's <br>'s, but its not putting them all on the same line in the text file, it's using multiple lines.. Any idea how to keep it all on 1 line? Thanks!
hm.... well i might be wrong with this, but a new line is started whenever there is a '\n' in the text-file. maybe it looks like many lines because the text breaks, but it should be 1, as we changed all \n's to <br />'s except the last one we added after the $message.... so if you read the file -that is probably what you are going to do- the system will read all the text up to the first \n as line 1.