> I have a routine where we input text to fields. When there is an
apostrophe it
> handles it correctly.  When the form is brought back for editing, the
field
> values show up in the input fields, with all apostrophes intact, just as
it
> should be.
>
> When I upload this script to my isp, it doesn't work..  The apostrophes
truncate
> the rest of the text.   'Don't cry over spilled milk', in a field, turns
into
> 'Don'...
>
> I have php4 mod in my win32 devbox.  The isp is php3.  Is this the
problem?
> What is the best way out of it please?

You have magic quotes on.
Your ISP doesn't.

Edit .htaccess file in your root web directory on your ISP host, and add:
php_flag magic_quotes_gpc On

(If I remember the directive correctly...  See php.ini to be sure.)

Your ISP may also not be allowing you to use .htaccess files for performance
reasons.  Alternative:

Write a function not unlike this:

function maybe_addslashes($text){
    if (magic_quotes_gpc()){
        return $text;
    }
    else{
        return addslashes($text);
    }
}

And, everywhere you move data from input to the database, you'll need to
call this function on your text.

The bonus here is that you can move from server to server without caring
which ones have Magic Quotes on/off or whether they have enabled .htaccess

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to