Current location: Hot Scripts Forums » Programming Languages » PHP » Why I always get \' and \" after I submit the form !


Why I always get \' and \" after I submit the form !

Reply
  #1 (permalink)  
Old 07-12-03, 05:14 PM
kevin kevin is offline
Newbie Coder
 
Join Date: Jun 2003
Location: USA
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Why I always get \' and \" after I submit the form !

Hello !

I have a textbox + area textbox in my form

Each time I submit the form - if I write something like


I'm a boy

I said "Hello"


then the result on next page become like this


I\\'m a boy

I said \"Hello\"


How to get rid off the thing \

Thanks
Reply With Quote
  #2 (permalink)  
Old 07-12-03, 06:00 PM
Man Down Man Down is offline
HS Staff
 
Join Date: Jun 2003
Location: Maryland
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Try this:

stripslashes("I\'m a boy");
__________________
Man Down
Reply With Quote
  #3 (permalink)  
Old 07-13-03, 03:03 AM
Stefan's Avatar
Stefan Stefan is offline
Junior Code Guru
 
Join Date: Jun 2003
Location: Utrecht, The Netherlands
Posts: 599
Thanks: 0
Thanked 0 Times in 0 Posts
or in this case: stripslashes($_POST['textarea'])

or whatever your textarea is called.
Reply With Quote
  #4 (permalink)  
Old 07-13-03, 11:00 AM
alesh.ru alesh.ru is offline
Internet-paraSITE
 
Join Date: Jul 2003
Location: Moscow, Russia
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
i prefer to use this code:
PHP Code:

        foreach($_POST as $k=>$v){

            
$k=striptslashes($_POST[$v]);
        } 
This code is more secure.
__________________
From Russia with love
Reply With Quote
  #5 (permalink)  
Old 11-24-03, 04:57 AM
fyrestrtr fyrestrtr is offline
Wannabe Coder
 
Join Date: Nov 2003
Posts: 191
Thanks: 0
Thanked 0 Times in 0 Posts
Alesh.ru : How is it more secure? You are generating variables -- trusting the user not to enter malicious data. That's not secure.

Kevin : The reason it is automatically escaping your data is because you have magic_quotes_gpc turned on in your php.ini file. See http://www.php.net/manual/en/functio...quotes-gpc.php and http://www.php.net/manual/en/ref.inf...gic-quotes-gpc for more information
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 10:27 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.