[thelist] PHP_SELF / Contact Form
DAVOUD TOHIDY
dtohidy at hotmail.com
Wed Aug 4 15:11:12 CDT 2010
> From: kipper_timmins at live.co.uk
> To: thelist at lists.evolt.org
> Date: Wed, 4 Aug 2010 19:46:55 +0100
> Subject: Re: [thelist] PHP_SELF / Contact Form
> Ahh this sounds like a new line issue to me from what I can glean.
> Could you let us know what isn't working? is it the text area not showing,
> information not getting through the validation?
> You might need to replace \n\r with your own newline characters such as
> [newline] or something like that with a string replacement.
> Sorry I can't be more specific,
> Hope this helps a bit
> Kevin
I found what is causing the problem:
I have:
$message = mysql_real_escape_string(htmlentities(strip_tags(stripslashes(trim($_POST['message'])))));
mysql_real_escape_string is causing the /n/r to show up inside the text area where the user message
is retained when the user submits the form. Removing mysql_real_escape_string along with adding:
<?php $message = str_replace(array("\r\n", "\n", "\r"),"<br />",$message); echo($message)?>
between the <textarea></textarea> will replace the \r and \n with <br />
However:
1-I do not want to remove the mysql_real_escape_string
2-I do not want to have the <br /> either
What I would like to have is just a new line exactly as the user had typed.
removing the <br /> from the above will remove the space between paragraphs in the message.
Any ideas? Anyone?
Thanks
davoud
More information about the thelist
mailing list