Php Help - Why Does My Form Add Blackslashes To Fields?
- Forums
- PHP
- Php Help - Why Does My Form Add Blackslashes To Fields?
This Page Contains information about Php Help - Why Does My Form Add Blackslashes To Fields? By wallpaperama in category PHP with 1 Replies. [1234], Last Updated: Sat May 18, 2024
wallpaperama
Wed Dec 24, 2008
1 Comments
336 Visits
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
; - 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.
https://www.wallpaperama.com/forums/php-help-why-does-my-form-add-blackslashes-to-fields-t6915.html