views:

78

answers:

3

I'm using zend frame work zend form and zend db for my project.

The problem I have is, when the user enter some special characters in the text field (i.e "I'm"), it is saved in the database with the "\" character (i.e. "I\'"). I need to know how to fix this so it just saved as whatever the user entered.

+3  A: 

You need to disable magic-quotes.

takeshin
A: 

http://www.php.net/manual/en/security.magicquotes.disabling.php

If you cannot for any reason disable them you can use stripslashes to strip those \ when getitng the data out of the db before echoing it to the browser.

Iznogood
No, always decode early and encode late. Save the raw data in the DB.
phyzome
A: 

use stripslashes(trim($value)); to strip the \ and remove the extra spaces.

Mallika Iyer