How to receive the proper content of 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
mandingueiro
Forum Newbie
Posts: 9
Joined: Fri Oct 03, 2008 6:46 pm

How to receive the proper content of a textarea?

Post 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?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

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

Post 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.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply