I using the PFBC (PHP form builder class (PFBC)) to create a TextBox element in page;
But in string with special character's he not change to normal characters:
ex: $razao = "livia's baby"
$form->addElement(new Element\Textbox("Razão Social:", "data[RAZAO_SOCIAL]", array(
"value" => htmlspecialchars_decode($razao, ENT_NOQUOTES) ,
"required" => true
)));
He print:
Any idea?
ENT_NOQUOTES
tells the htmlspecialchars_decode
to not decode single or double quotes. Use ENT_QUOTES
.
Will convert both double and single quotes.
vs.
Will leave both double and single quotes unconverted.
-http://php.net/manual/en/function.htmlspecialchars-decode.php
htmlspecialchars_decode($razao, ENT_QUOTES)
Demo: https://3v4l.org/ZSH7G
Be careful with this though, depending on $razao
's value you might open yourself to XSS injections.