In some case, the PHP4 configuration on Linux shared hosting will be default "ON" for magic_quotes_gpc. This cause the single and double quote will be escape with backslash (\). It doesn't matter if you do addslashes or not.
So the magic_quotes_gpc has to be turned off. Tried the following in the .htaccess file. Put this file under the web root.
php_flag magic_quotes_gpc off
php_flag magic_quotes_runtime off
If it doesn't work, them put the following php.ini file in every folders that is root of the script.