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
+7k Golang : Randomize letters from a string example
+4.1k Linux/Unix/MacOSX : Find out which application is listening to port 80 or use which IP version
+9.8k Golang : Web routing/multiplex example
+14.3k Golang : How to convert(cast) IP address to string?
+10.4k Golang : Concurrency and goroutine example
+10.3k Golang : Fuzzy string search or approximate string matching example
+20.2k Golang : Upload big file (larger than 100MB) to AWS S3 with multipart upload
+11k Golang : Encrypt and decrypt data with x509 crypto
+16.1k Golang : delete and modify XML file content
+9.3k Generate Random number with math/rand in Go
+7.7k Golang : Gorilla web tool kit schema example
+18.2k Golang : Delete item from slice based on index/key position