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
+29.5k Golang : How to declare kilobyte, megabyte, gigabyte, terabyte and so on?
+8.1k Golang : Implementing class(object-oriented programming style)
+35.5k Golang : Save image to PNG, JPEG or GIF format.
+7.8k Golang : Multiplexer with net/http and map
+47.6k Golang : How to convert JSON string to map and slice
+9.2k Golang : Convert(cast) string to int64
+11.6k Golang : Setup API server or gateway with Caddy and http.ListenAndServe() function example
+14.7k Golang : package is not in GOROOT during compilation
+20.1k Nginx + FastCGI + Go Setup.
+15.9k Golang : convert string or integer to big.Int type
+62.4k Golang : Convert HTTP Response body to string