Chris Farrugia wrote:
Greetings,



On one of my forms to send email, I have multiple line breaks with different
paragraphs.  I looked up the nl2br function and that looks like an option,
but I would ideally like to wrap these paragraphs inside <p></p> tags.  Is
there a way to do this easily?  Any advice would be greatly appreciated.

I'm sure somebody will have a 'cleaner' way, but...

$text = preg_split ( "/\n/", $inputText );
for ( $i = 0; $i < sizeof ( $text ); $i++ ) {
        if ( $text[$i] != "" ) {
                $text[$i] = "<p>" . $text[$i] . "</p>";
        }
}

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to