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
+5.5k Golang : Configure crontab to poll every two minutes 8am to 6pm Monday to Friday
+8.5k Golang : Convert(cast) []byte to io.Reader type
+5.8k Golang : Launching your executable inside a console under Linux
+12.4k Elastic Search : Return all records (higher than default 10)
+6.1k Golang : Get Hokkien(福建话)/Min-nan(閩南語) Pronounciations
+8.5k Golang : Progress bar with ∎ character
+8.4k Golang : Generate Datamatrix barcode
+10k Golang : Identifying Golang HTTP client request
+10.2k Golang : Detect number of faces or vehicles in a photo
+7k Golang : Takes a plural word and makes it singular
+8.1k Golang : HttpRouter multiplexer routing example
+5.3k Golang : Reclaim memory occupied by make() example