Forum Moderators: coopster

Message Too Old, No Replies

Line breaks using PHP

line breaks or paragraph break using PHP

         

jennashton

8:03 am on Feb 29, 2004 (gmt 0)

10+ Year Member



Hi all,

I have a PHP script that I need debugging. Below is part of a script I have going. It bascially outputs what has been entered in the form field. Currently, it outputs a long line with no breaks. How can I add paragraph breaks after 25 words or so?

fputs($file,<font color=\"#9D0000\">Message:</font> $message\n\n");
fclose($file);

So, if prints the message from prior page that is entered via form field. It prints as one huge line of text with no breaks.

Thanks ahead.

jatar_k

7:48 pm on Feb 29, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Do they enter into a textarea or something? You could convert the input then by using nl2br [ca.php.net]. If you try to insert them rndomly you will have to do a lot more work to make sure you don't put one in the middle of a sentence.