Re: [PHP] forms addslashes ?

2003-06-19 Thread Jason Wong
On Thursday 19 June 2003 20:27, Mukta Telang wrote:

> 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 ";
> $title=addslashes($title);
>
> But the string that gets added has a lot of slashes!

What exactly do you mean by "a lot of slashes" ?

> How should this be done?

Check in php.ini that:

  magic_quotes_gpc = Off

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Death is nature's way of saying `Howdy'.
*/


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



Re: [PHP] forms addslashes ?

2003-06-19 Thread Lars Torben Wilson
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 ";
> $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



[PHP] forms addslashes ?

2003-06-19 Thread Mukta Telang
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 ";
$title=addslashes($title);

But the string that gets added has a lot of slashes!
How should this be done?
Mukta

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