Hi, I have this Zend_Form and it’s value get changed.
My input text in the form gets modified like for example:
instead of the text It's a great day I get It\'s a great day
I use
$name = new Zend_Form_Element_Text('name');
$name->setRequired(true);
$name->setFilters(array('StringTrim', 'StripTags'));
$name->setDecorators(array(
'Errors',
'viewHelper',
));
How can I fix this?
This is due to your PHP uses magic quoting.
Check if
get_magic_quotes_gpc()returns TRUE. If it does then\ ' " &chars in GET and POST request data will get escaped with\.To counter that you must use additional filter function like
stripslashes()or follow this example to do it properly in Zend Framework:http://blog.philipbrown.id.au/2008/10/zend-framework-forms-and-magic_quotes_gpc/
// Appendix:
On your local machine you can do what the Sudhir explained in his answer, but on a shared hosting that might not be possible unless you have access to
php.inifile or PHP is loaded asApachemodule (mod_php/mod_php5)