On Thu, 2003-06-19 at 05:27, Mukta Telang wrote:
> Hi,
> I want to add slashes to a string, if it contains quotation marks and
> which is received as input from a form, so that I can enter it to a
> database.
> What I am doing is as follows:
> 
> echo "<input type=\"text\" name=\"title\">;
> $title=addslashes($title);
> 
> But the string that gets added has a lot of slashes!
> How should this be done?
> Mukta

Do you mean that there are two slashes everywhere there should be one,
or that they are inserted where you do not expect them?

It's slashes doubling up on you, you may have magic_quotes_gpc enabled
in php.ini. magic_quotes_gpc is explained here:

  http://www.php.net/manual/en/ref.info.php#ini.magic-quotes-gpc

You can check whether it's turned on with:

  http://www.php.net/get_magic_quotes_gpc
  http://www.php.net/get_magic_quotes_runtime

So if that's the case, you could either disable magic_quotes in
php.ini, or else test whether it's turned on and then decide whether to
call addslashes().


Torben


-- 
 Torben Wilson <[EMAIL PROTECTED]>                        +1.604.709.0506
 http://www.thebuttlesschaps.com          http://www.inflatableeye.com
 http://www.hybrid17.com                  http://www.themainonmain.com
 -----==== Boycott Starbucks!  http://www.haidabuckscafe.com ====-----




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to