Re: Line breaks in form

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
john@xxxxxxxxxxxx

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux