Click to See Complete Forum and Search --> : URGENT! Edit Signature feature for forums


Jellybean
02-28-2005, 11:49 AM
Hi,

Really really need help here....very urgent...thanks!

I am currently creating a feature that is much similar to the edit signature feature in this forum.

However, I am running into this problem. Whenever the user keys in something like this in the textarea,


This is

an example


This should be the statement to be updated in the database.


<p>This is</p><p>an example</p>


However, this is what I get in the database


<p>This is</p>
<p>an example</p>


As such, when users were to edit their signature, they couldn't do so, since nothing could be retrived from the database and reflected in the textarea for editing.

I have tried to replace "/n" with "hehe", like this:


$enter="\n";
$replace="here";

$standard_reply = str_replace($enter, $replace, $standard_reply);


original statement is something like this


$standard_reply = "<p>Dear ,</p><p>Finally I have a paper that is relevant to your research areas. I would therefore appreciate it very much if you could help preview the paper, <i>$title</i>, and give me your precious opinions.</p><p>Thank you and good day.</p>";


But but but after the replacement, it becomes this


$standard_reply = "here<p>Finally I have a paper that is relevant to your research areas. I would therefore appreciate it very much if you could help preview the paper, <i>$title<here<p>&nbsp;</p> |d good day.</p>s.</p>";


I find the result so unbelievable!

I am much in doubt. Please advise. Thanks!

Jona
02-28-2005, 01:04 PM
Perhaps try...


$str = preg_replace("/\n+/s", "", $str);

Jellybean
02-28-2005, 02:00 PM
Tried, but no luck :(

Jona
02-28-2005, 02:09 PM
Have you tried autop (http://photomatt.net/scripts/autop)?