Page 1 of 1

Parsing new "\n" as "\n\t" in a textarea

Posted: Mon Nov 22, 2004 3:51 am
by dave_84
Hi Guys, i am making a fairly basic forum, i wanted to have the ability to quote other messages, so i put a link on each message so that when it was clicked the message got dragged through to a textarea where the user could edit it. My problem is that i want this message to be tabbed to differentiate it from the message getting written in response.

At the moment, the text dragged through looks like so (tabs dont seem to work so i have written which lines are tabbed in):
-----------------------------------------------------------------------------------
--Begin Quote-- //this line is tabbed

alternator... and i cant do my svq. //this line is tabbed

can anyone help, //this line isnt tabbed

cheers, //this line isnt tabbed

Billy //this line isnt tabbed

--End Quote-- //this line is tabbed

Cant help im afraid! //this line isnt tabbed
------------------------------------------------------------------------------------

i would prefer it if the whole quote was tabbed in, here is my code, i am very grateful to anyone who can help.

Code: Select all

echo("<td><textarea name='form_content' rows='15' cols='50'>\t--Begin Quote--\n\n\t" . $content . "\n\n\t--End Quote--</textarea></td>");
Cheers,

Dave

Posted: Mon Nov 22, 2004 4:18 am
by dave_84
Ahh well... just done it... funny how things happen like that isnt it... here is the code:

Code: Select all

echo("<td><textarea name='form_content' rows='15' cols='50'>\t--Begin Quote--\n\n\t" . str_replace("\n", "\n\t", $content) . "\n\n\t--End Quote--</textarea></td>");