0

Hi there,
I am currently facing some problems with return carriages.
I have an address already in a table in the database which has return carriages.
Now when you echo the address out it will loose the return carriages and instead will put it all on one line.

I have tested it by copying and pasting the original address from the db to Microsoft Word which shows that there are return carriages and displays on each line. However when you copy and past the address echoed out on the page into word, it does not show any symbols for return carriages and displays on one line.

I have tried creating functions like below which also does not work!

function rcarriage($string){
$string = str_replace(chr(13),"<br/>",$string);
return $string;
}

The 'chr(13)' means its a return carriage.

My understanding to this problem is it may lose return carriages upon fetching it back to the page??

I have also tested the address in a textarea box and it will display on each line as it suppose to.

I hope someone can help!

Thanks

Jat

3
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by urtrivedi
0

If above fails, try this:

function rcarriage($string){
         $string = str_replace("\n","\n<br>", $string);
          return $string;
      }
0

Hi,

nl2br worked!
The only small issue was that I had to apply it to the actual row e.g. nl2br($row) and could not get it to work from within a variable e.g. $add = nl2br($row). God know's why!

Thanks guys

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.