[thelist] Tiny Problem

Jay Blanchard jay.blanchard at niicommunications.com
Tue Oct 15 13:06:00 CDT 2002


[snip]
Just a quick question, and it's really daft but it's bugging me, in
an input area of a form, say a large "textarea" when anyone makes a carriage
return {like at the end of a paragraph) and then they send the information,
when it renders back from the MySQL table where it's stored, the carriage
returns are never present.

So at the moment when anyone enters any info and want's to end a paragraph
and start a new one, it's a case of adding <BR><BR>, is there a way to get
around this? (using PHP).
[/snip]

There are new line (\n) characters and there wil be 2 in a row (\n\n) when
the person hits two 'enters' to break the paragraphs in the text area. Use
an eregi_replace() to replace this with either two breaks (<br><br>) or you
can actually use <p> tags like this in your template;

<p>
<?php
//get data from database for $textarea
do the eregi_replace subbing '</p><p>' every time there are two newlines
?>
</p>

http://www.php.net/manual/en/function.eregi-replace.php

HTH!

Jay





More information about the thelist mailing list