Hello
I am inserting About Me text into my DB and whenever I update this text, I got more added slashes e.g.
first I enter
I 'm here again, it 'll enter I \'m here again in DB and then when again I update it, it becomes, I \\\'m here again and then on other update, it becomes, I \\\\\\\'m here again and so on...
Please let me know what should I do to avoid it?
TIA
every time i get more slashes with my text
Moderator: General Moderators
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
Re: every time i get more slashes with my text
Turn off magic_quotes.amir wrote:Hello
I am inserting About Me text into my DB and whenever I update this text, I got more added slashes e.g.
first I enter
I 'm here again, it 'll enter I \'m here again in DB and then when again I update it, it becomes, I \\\'m here again and then on other update, it becomes, I \\\\\\\'m here again and so on...
Please let me know what should I do to avoid it?
TIA
You are supposed to use htmlspecialchars() when echoing data into an HTML element anyway.miro_igov wrote:stripslashes() is not good if you display the text in <input type="text" name="bla" value="<?php echo $result['bla'] ?>"> because the string will be trimmed if it contains quotes.
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Magic quotes doesn't need to be off. Your code needs to support it being on and off.
get_magic_quotes_gpc() + stripslashes() for the normalization of submission data.. then whatever escaping function required by your database of choice. No need to stripping on the return end if done correctly.
get_magic_quotes_gpc() + stripslashes() for the normalization of submission data.. then whatever escaping function required by your database of choice. No need to stripping on the return end if done correctly.