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
+16k Golang : Get own process identifier
+24.8k Golang : missing Mercurial command
+10.9k Golang : How to detect a server/machine network interface capabilities?
+22.9k Golang : Upload to S3 with official aws-sdk-go package
+23.8k Golang : Create PDF file from HTML file
+7.3k Golang : Variadic function arguments sanity check example
+8k Yum Error: no such table: packages
+31k Golang : Validate email address with regular expression
+13.7k Golang : Execute function at intervals or after some delay
+12.5k Golang : Image to ASCII art example
+15.4k Golang : Check if a string contains multiple sub-strings in []string?
+4.7k Golang : Stop goroutine without channel