[FX.php List] Keeping Carriage Returns in Textarea submissions
Kevin Futter
kfutter at sbc.melb.catholic.edu.au
Fri Aug 10 00:37:12 MDT 2007
On 10/8/07 2:06 PM, "Jonathan Schwartz" <jschwartz at exit445.com> wrote:
> Nope. That was the question, all right.
>
> That was easier than I thought. I'd love to have the function.
>
> Thanks
>
> J
Hi Johnathan,
Try this out:
// function to replace line breaks in FM output with <br /> or <p> elements
function formatDesc($input)
{
$br = chr(10); // single line feed character (LF)
$p = "<br />\n<br />\n";
$badChars = array($p, "& ");
$goodChars = array("</p>\n\t\t<p>", "& ");
$text = str_replace($br, "<br />\n", $input); // replace LF with <br />
$description = str_replace($badChars, $goodChars, $text);
echo "<p>" . $description . "</p>\n";
}
Modify it as you need to!
--
Kevin Futter
Webmaster, St. Bernard's College
http://www.sbc.melb.catholic.edu.au/
#####################################################################################
This e-mail message has been scanned for Viruses and Content and cleared
by MailMarshal
#####################################################################################
This e-mail and any attachments may be confidential. You must not disclose or use the information in this e-mail if you are not the intended recipient. If you have received this e-mail in error, please notify us immediately and delete the e-mail and all copies. The College does not guarantee that this e-mail is virus or error free. The attached files are provided and may only be used on the basis that the user assumes all responsibility for any loss, damage or consequence resulting directly or indirectly from the use of the attached files, whether caused by the negligence of the sender or not. The content and opinions in this e-mail are not necessarily those of the College.
More information about the FX.php_List
mailing list