note 21855 deleted from function.nl2br by tomsommer
| From: | tomsommer@php.net | Date: | Sun, 27 Jun 2004 19:09:37 +0000 |
| Subject: | note 21855 deleted from function.nl2br by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-71951@lists.php.net to get a copy of this message | ||
Note Submitter: jhfh@hetnet.nl
----
for the br2nl problem, use:
(in php)
function br2nl($string) {
$string = str_replace('<br />|<br/>|<br>', '\r\n', $string);
return $string;
}
(in javascript, header of the document)
<SCRIPT language="JavaScript">
MyString="<?php print br2nl($YourTextFromDatabase); ?>";
</SCRIPT>
and, finally, in the body tag:
onLoad="document.formName.NameofTextarea.value=MyString"
now, you have the text in your textarea, just the way people entered it!
maybe there's a (little) error in the script, but it works fine for me!
(please send comments to the e-mailaddress above)