php help - why does my form add blackslashes to fields?

Mobile
feeds
Welcome Login | Register

php help - why does my form add blackslashes to fields?
Reply Your Comments:
Click this button if you are interested in replying to this topic and leave your comments
Sent To Friend
CLick this button if you want to send this page to a friend.
Subsribe To Rss Feeds
Subscribe to RSS
CLick this button if you want to subscribe to this RSS Feed. You can use your browsers feeds burners if you have mozilla or internet explorer 7 or higher and keep up with updates.
  Forums Index
      » PHP Forums
        » » php help - why does my form add blackslashes to fields?
php help - why does my form add blackslashes to fields?
Post Description: php help why does my form add blackslashes to fields PHP
Post Tags:
This Post Has Been Viewed 44 Times Since Wed Dec 24, 2008 4:11 pm Author wallpaperama with 1 replies
php help - why does my form add blackslashes to fields?
Advertise On This Page




when i first started writing scripts for php, sometimes i noticed that when i submitted a form, the fields would have blackslashes and the more i submit the form the more i get, it keeps incrementing more and more. for example

if i have a form with a field called username and i enter: wallpaperama's it would come out as wallpaperama's and if i submitted again wallpaperama'\s and again wallpaperama'\\s

so whats causing this. well, im going to tell you. because i just found out after years of wondering.

they way i found out is by running a phpinfo.php and in the php configurations, there is a setting thats called magic_quotes_gpc in my case they were on, so what i needed to do was to turn them off, you can turn it off by editing your PHP.INI file

if you want to get more information visit:

http://www.php.net/manual/en/function.get-magic-quotes-gpc.php

hope this helps



Leave Your Comments

Your Name
Your Email Address (Will Not Be Published)
Notify Me When Someone Replies to this Page
(An email will be sent to you when someone replies to your comments)
Your Comments
Include A Picture with your comments
Share
| More
Share this page by putting this URL in your comments to other websites like myspace, Facebook, Twitter friendster, Hi5, Groups, Boards, Forum or others. Just Copy and Paste this Code
URL:
To embed this topic, just copy the code from the "Embed" box. Once you've copied the code, just paste it into your website or blog to embed it.
Embed:
BBCODE is use on forums. You can put this code on all your BBCODE enabled forums like PhpBB, vBulletin® and others. Just Copy and Paste this code on your Posts and Replies on your forums
BBCODE:
Subscribe Feeds
Webmasters - Exchange Links With Us. Add related websites to this topic
Add Link:
Links Related to : php help - why does my form add blackslashes to fields?

Comments and replies About php help - why does my form add blackslashes to fields?
:: 1 :: Reply #87996 Reply By wallpaperama On Mon Dec 29, 2008 4:27 pm
wallpaperama:
if you have access to your php.ini file, you can change it there. open your php.ini and look for this:

; - magic_quotes_gpc = off [performance]
; input data is no longer escaped with slashes so that it can be sent into
; sql databases without further manipulation. instead, you should use the
; function addslashes() on each input element you wish to send to a database.