simple input formatting questions

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
icecold
Forum Newbie
Posts: 1
Joined: Fri Aug 29, 2008 4:34 pm

simple input formatting questions

Post by icecold »

hello,

i have a contact form with an input (multi line text box), when i merely pass the raw input into the email body i receive it fine; carriage returns in particular work ("\r\n) and so a multi lined input message appears multi lined in the email.

but, when i filter the input through strip_tags and then mysql_real_escape_string the email opens with the "\r\n" bits visible and the message all on one line.

what is it about strip_tags or mysql_real_escape_string that causes the "\r\n" to not work, even though they are there?

thanks
alfredwong
Forum Newbie
Posts: 3
Joined: Fri Aug 29, 2008 4:37 pm

Re: simple input formatting questions

Post by alfredwong »

i think strip_tags do that.

i use another one too:

$order = array("\r\n", "\r", "\n");
$answer_text = str_replace($order, " ", $answer);

This will take off the '\r' and '\n'.

Don't know is it what you need.
But hope this will help
Post Reply