NYCPHP Meetup

NYPHP.org

[nycphp-talk] Changing "\n" in textarea

keith at keithjr.net keith at keithjr.net
Sat Feb 7 08:42:26 EST 2004


$newtext = str_replace("\n","<p>",$oldtext);

that would replace any newlines with new paragraph tags in html. You could
also use <br> for the newline.

> Okay, noob here.
>
> I am using a textarea for a form that will get put into a MySQL text
> column. The problem is that I have it write to a flat file first, lines
> terminated by newlines.
>
> How do I pull out newlines in the text area and make then "<p>" type
> things before it get written to the flatfile?
>
> ciao!
>
> leam
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>




More information about the talk mailing list