CodeIgniter : form input set_value cause " to become & quot
Problem :
A string retrieved from database contains "
and when you try to display the string with Form Helper's set_value()
function. The "
becomes "
How to fix this problem?
Solution :
By default the set_value()
function will escape the value. (see http://www.codeigniter.com/userguide3/helpers/formhelper.html#setvalue) and this will cause "
to become "
Therefore, to fix this problem, turn off the HTML escaping by setting false
in the 3rd parameter of the set_value()
function.
From
set_value('sometitle', $sometitle);
to
set_value('sometitle', $sometitle, false);
This should prevent the "
to become "
now after disabling the default HTML escaping.
Reference :
http://www.codeigniter.com/userguide3/helpers/formhelper.html#setvalue
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+11.8k Golang : Setup API server or gateway with Caddy and http.ListenAndServe() function example
+33.9k Golang : Create x509 certificate, private and public keys
+5.5k Javascript : How to refresh page with JQuery ?
+9.8k Golang : Translate language with language package example
+8k Android Studio : Rating bar example
+7.7k Swift : Convert (cast) String to Double
+5.5k Golang : Configure crontab to poll every two minutes 8am to 6pm Monday to Friday
+7.2k Golang : Not able to grep log.Println() output
+21k Golang : Create and resolve(read) symbolic links
+5.6k Linux/Unix/PHP : Restart PHP-FPM
+21.6k Golang : Convert string slice to struct and access with reflect example
+27.4k PHP : Convert(cast) string to bigInt