Page 1 of 1

How to receive the proper content of a textarea?

Posted: Tue Dec 09, 2008 11:39 am
by mandingueiro
Hello people,

Well I made a simple HTML form that contains a textarea

Code: Select all

<textarea rows="35" cols="75" name="message"/></textarea>
and in the file that is called by the form I want to receive the content of the textarea but in the right way (I mean just like as the user entered it, with new lines, HTML tags etc). I can receive it through $_GET['message'] but it when I print it it doesn't contain the break lines. Do you know the way to receive it the right way?

Re: How to receive the proper content of a textarea?

Posted: Tue Dec 09, 2008 11:43 am
by pickle
The line breaks as submitted are new-line characters, which are not interpreted by HTML rendering engines. You can run it through nl2br() or wrap $_GET['message'] in <pre></pre> tags.