This sounds like a bad case of magic_quotes confusion.
When I add text to the MySQL database I use this function which will only addslashes if magic_quotes_gpc is off:
PHP Code:
function add_slashes ( $text )
{
if ( !get_magic_quotes_gpc() )
{
$text = addslashes( $text );
}
return $text;
}
If I am displaying data from a form (but not the database) I use this function, which will stripslash the variable if it has automaticaly be slashed by the magic_quotes:
PHP Code:
function strip_slashes ( $var )
{
if ( get_magic_quotes_gpc() )
{
$var = htmlentities ( stripslashes ( $var ) );
}
return $var;
}
HTH
Chris
Bookmarks