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
+4.5k How to check with curl if my website or the asset is gzipped ?
+16.8k Golang : Check if a directory exist or not
+11.3k Elastic Search : Return all records (higher than default 10)
+15k Golang : Get file permission
+18.3k Golang : Determine if directory is empty with os.File.Readdir() function
+13.4k Golang : Get URI segments by number and assign as variable example
+10.3k Golang : Display a text file line by line with line number example
+8.4k Golang : Get all countries currencies code in JSON format
+2k Golang : Fix go-cron set time not working issue
+11k Golang : How to parse plain email text and process email header?
+81.4k Golang : How to convert character to ASCII and back
+21.2k Golang : Round float to precision example