I used the jquery function serialize() for a form, made an ajax call, and use php to do the form processing.

I have a textarea in that form where users type uses spaces and line breaks. I can access the values with $_POST, but its doesnt interpret the line breaks into html <br/ > tags. Is there a function that converts line breaks the urlencoded string into <br/> tags and other html tags? Or is everything already decoded by the time i access it with $_POST that i cant do anything with it?

Accepted Answer

Use nl2br($text); (new-line to break-rule)

Written by Frits van Campen
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki