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
+9.7k Golang : Populate slice with sequential integers example
+11.5k Golang : Format numbers to nearest thousands such as kilos millions billions and trillions
+46.6k Golang : Marshal and unmarshal json.RawMessage struct example
+22.2k Golang : Print leading(padding) zero or spaces in fmt.Printf?
+22.3k Golang : Convert seconds to minutes and remainder seconds
+19k Golang : Padding data for encryption and un-padding data for decryption
+7.8k Golang : Scan files for certain pattern and rename part of the files
+7.9k Javascript : How to check a browser's Do Not Track status?
+6.7k Golang : Reverse by word
+6.2k Golang : Get missing location after unmarshal binary and gob decode time.
+6.9k Mac OSX : Find large files by size
+8.8k Golang : Gorilla web tool kit schema example