Dealing with apostrophes in form input - output
Posted: Mon Oct 17, 2005 10:57 pm
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...
wondering how to handle the apostrophes...
any help appreciated in advance..
thanks.
mc
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);any help appreciated in advance..
thanks.
mc