Solved

Keep getting backslashes added through GET

Posted on 2007-03-20
3
298 Views
Last Modified: 2013-11-19
Hi
I am running PHP v 5.2.0 and now when I pass something through GET that has a quote mark in it I get an escape backslash if I then pass that on again I get another backslash added
ie
.php?id=1&t=entertainment&ttl=The%20Sorcerer's%20Apprentice
there's a quote (apostrophe)  between the word Sorcerer and the s

The next time I pass it on I get
php?id=1&t=entertainment&ttl=The%20Sorcerer\'s%20Apprentice
It has added a backslash but in the page it shows 2 backslashes
How can I get rid of this quirk???
Thanks in advance
0
Comment
Question by:TonyHull
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 24

Accepted Solution

by:
glcummins earned 200 total points
ID: 18757321
Check your php.ini file for lines that look like:

magic_quotes_*

and change them to 'Off'

Magic Quotes automatically tries to escape input to your script, which is usually an annoyance. For more information, see http://us3.php.net/magic_quotes
0
 
LVL 9

Assisted Solution

by:richdiesal
richdiesal earned 150 total points
ID: 18757333
It sounds like you have magic_quotes_gpc set to On in your php.ini.  You could just turn this off.

If you don't want to do that, the stripslashes() function will also get rid of slashes.
0
 
LVL 48

Assisted Solution

by:hernst42
hernst42 earned 150 total points
ID: 18757342
Check your php.ini-settings for magic_quotes_gpc. If that option is turned on (typical to prevent SQL-injections). Every time you access $_GET/$_POST you will need to use stripslashes($_POST['varname']);
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question