View Full Version : Insert break

09-02-2008, 04:21 PM
What I am trying to do is simple. When I get the data from a text area in a textbox in a form , here is what I am doing to put it in a doc file.

$resume = $_POST['resume'];

$profile = $_POST['lname']."_"."Profile".$filedate.".doc";
$profile = fopen($profile, "w") or die( "Error opening file" );

flock ($profile, LOCK_EX);

$doc_content = "<html><head></head><body>
<b>Resume: </b> <br> $resume <br>

fwrite ($profile, $doc_content);

Since it is a multiline text area, MS Word ignores the breaks in the text area.

so if i put:

Since it
is a multiline
text area.

It shows as

Since it is a multiline text area.

I think the way to get that is to take it (textarea) in an array and then append a break tag (<br>) at the end of each line. Am I in the right direction? If so, how do i do it?


09-02-2008, 04:26 PM
echo' < /br>;

echo "$resume\n";

"\n" is parsed as new line, or line break. Or you can just force a <br> into the HTML (top option)

The newline passed in an echo or print() is sent to the browser as
string information, not formatting information. You need a <BR> tag in
your code to create a line break in HTML.

You can also use the nl2br(string myoutput) function to turn newlines
into <BR> tags.


09-02-2008, 05:19 PM
Thank you! nl2br() work perfectly.