problem with my textarea field

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
adsegzy
Forum Contributor
Posts: 184
Joined: Tue Jul 28, 2009 9:26 am

problem with my textarea field

Post by adsegzy »

Hello friends,

AM having a problem with my textarea field of my feedback form. My feedback form requires name, email and message. Using PHP scripting. if any of the 3 fields is not filled it will retuen the page with the content of the field that was filled but the way its displaying the content if the textarea is confusing to the visitors (though am still testing on my local PC). Eg let's assume the visitor enter the below content into the textarea;
Hello,

AM just testing this feedback form.

Regards
If the visitor failed to fill the other fields (name or email) and the server will have to return the page for completion, what will appear on the textarea is
Hello,\r\n\r\nAM just testing this feedback form.\r\n\r\nRegards
and this could be confusing to visitors.

please what is the way out.

regards
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: problem with my textarea field

Post by Christopher »

Do you escape the output with htmlspecialchars() or other function?
(#10850)
adsegzy
Forum Contributor
Posts: 184
Joined: Tue Jul 28, 2009 9:26 am

Re: problem with my textarea field

Post by adsegzy »

No. i named the field 'message', so i used

Code: Select all

<?php echo nl2br($message); ?>
Post Reply