try using the function nl2br() this doesnt just convert new lines to <br />'s, it retains the new line as well, so that your output is multi line. try this:
YOUR ERROR:
--------------------
your error was use of chr(13) and chr(10) use \r \n for carriage return and linefeed in php
SOLUTION
--------------
I am giving a piece from one of my projects it has been under test for long and in pretty many projects its bound to work
I made it a function as i use it many times over. So its in an include file and is
function FormatForWeb($stringMain)
{
$stringMain=eregi_replace("\n","<br>",$stringMain);
return $stringMain ;
}
-----------------
EXAMPLE USE
-----------------
to use I am using the same varibles a sgive in your question ie $_POST["txtDescription"] from this line i assume that you have a text box named 'xtDescription' instead of $_POST["txtDescription"] I am using variable '$txtDescription'. This is same as php automativcally creats any variable from the POST data
-----------------
'more unreadable alternative is many people believe such cryptic coding is power coding
'but analysying this code u shall see its just saves space and no performance differance
print(FormatForWeb($txtDescription)
----------------------------
additional function
----------------------------
just for sake of completion iam giving below the other function that takes a html and makes it a regular crlf saparated strinfg useful if you need to paste in some text box or something
function FormatForWeb($stringMain)
{
$stringMain=eregi_replace("<br>","\n",$stringMain);
return $stringMain ;
}
---Regards and have fun
0
Question has a verified solution.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
try using the function nl2br() this doesnt just convert new lines to <br />'s, it retains the new line as well, so that your output is multi line. try this:
<tr>
<td colspan="2">'.echo(nl2br(h
</tr>
if you want to keep the char spacing even (which is always good for emails), i would persoanlly just stick it in pre tags, like this:
<tr>
<td colspan="2"><pre>'.echo(ht
</tr>
that will echo your everything exaclty as it was typed.
hope thats what your after...