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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dave_84
Forum Newbie
Posts: 2
Joined: Mon Nov 22, 2004 3:27 am

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

Post 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
dave_84
Forum Newbie
Posts: 2
Joined: Mon Nov 22, 2004 3:27 am

Post 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>");
Post Reply