Page 1 of 1

Dealing with apostrophes in form input - output

Posted: Mon Oct 17, 2005 10:57 pm
by michlcamp
I have a form that members to my site fill out with bio information, then the form data is posted to a database table.


They often include apostrophes in the text, which when output to a database-generated page display backslashes in front of the apostrophe.

ex: "Welcome to Mike\\\'s page..."

I know this is a fairly common problem but am wondering what code to include that will:

1) keep the slashes from being added in when the form data is input to the table,

and

2) keep them from displaying in the output.

I'm already using "str_replace(Chr(13)," code to display the line breaks from the textarea field...

Code: Select all

$bio=mysql_result($result,$i,"bio");
$bio2=str_replace(Chr(13), "<br>", $bio);
wondering how to handle the apostrophes...

any help appreciated in advance..
thanks.
mc

Posted: Mon Oct 17, 2005 11:07 pm
by feyd