View Full Version : str_replace

07-22-2007, 05:01 PM
Hi i used the <pre></pre> tags so when the user writes a blog and presses enter, it will create a break, however when they type and the text automaticaly goes under neith it counts it as one line whic streches the page.

I have come up with this idea:


echo str_replace("<br>"," *SOMTHING HERE* ","$row['blog']");


also if thats right, what will go where SOMETHING HERE is and is the $row['blog'] correct.

07-22-2007, 05:09 PM
Hi there,

Could you provide a little more info? I assume you are placing the data returned from the textarea of a posted form block within the pre tag ... in which case you don't have to do anything to the data.

07-22-2007, 05:55 PM
AFAIK you'd replace \n with <br>.

07-22-2007, 06:09 PM
In which case you should be using the nl2br function

echo nl2br($row['blog']);

07-23-2007, 09:09 AM
oh thanks guys, i senn the nl2br but i didnt realies than nl was the space 2 was changeto and br obv the break