Re: my bugaboo.

From: Date: Sun, 04 Feb 2001 05:31:42 +0000
Subject: Re: my bugaboo.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-38077@lists.php.net to get a copy of this message
> 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

« previous php.general (#38077) next »