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
+7.1k Golang : Reverse text lines or flip line order example
+11.6k Golang : Convert int(year) to time.Time type
+10.5k Golang : Get remaining text such as id or filename after last segment in URL path
+10.7k Golang : Perform sanity checks on filename example
+9.1k Golang : Wait and sync.WaitGroup example
+18k Golang : Check if directory exist and create if does not exist
+25.1k Golang : Encrypt and decrypt data with AES crypto
+5.5k Golang : Calculate diameter, circumference, area, sphere surface and volume
+12.5k Golang : Reverse IP address for reverse DNS lookup example
+10.4k Golang : Secure file deletion with wipe example
+10.5k Golang : Sort and reverse sort a slice of runes
+14k Golang : Force download file example