I'm trying to preserve spaces in messages from my database that I echo onto my web page. However, HTML always gets rid of all spaces except one. I have tried:
$message = str_replace(" ", " $nbsp ", $message);
echo ("$message");
But it still does only one space.
as well as:
$message = str_replace(" ", " $nbsp; ",$message);
echo ("$message");
This prints spaces and semicolons.
To verify that the spacing is correct coming out of the database I did:
$message = str_replace(" ", " blah ",$message);
echo ("$message");
Which would print something like "This blah blah blah is blah a blah blah blah blah blah test".
Therefore, I know the spaces are there.
How can I get them to stay when I echo $message?
Thanks,
John