Solved

Keep getting backslashes added through GET

Posted on 2007-03-20
3
286 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
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

776 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