[ciapug] Formatting with line breaks...
David Champion
ciapug@cialug.org
Fri, 12 Dec 2003 16:29:12 -0600
Chris Hettinger wrote:
>I am trying to insert into a db field a note entry which will contain the details of a web form, but I have to build that long note entry first, and do some light formatting like line breaks...
>
> $note = "Generate from Web Form Submission \r\n"
> . "testing note formatting. \r\n";
>
>How ever this isn't working as I would have suspected. For testing it as I build it I am just echoing it out to the browser with <?= $note; ?> ... It displays but is not including the line breaks.
>
>
This:
echo "test \r\n";
Is not the same as this:
$x = "test \r\n";
echo $x;
Try it.
The "\r\n" are escaped control characters.
To build those into a string you need to insert the actual CR and LF
ascii characters.
-dc