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
+48k Golang : Upload file from web browser to server
+21.3k Golang : Use TLS version 1.2 and enforce server security configuration over client
+16.9k Google Chrome : Your connection to website is encrypted with obsolete cryptography
+21.9k Golang : How to read JPG(JPEG), GIF and PNG files ?
+21.6k Golang : How to run Golang application such as web server in the background or as daemon?
+17.2k Convert JSON to CSV in Golang
+14k Golang : How to get URL port?
+15k Golang : Intercept Ctrl-C interrupt or kill signal and determine the signal type
+46.9k Golang : Convert int to byte array([]byte)
+7k Golang : Dealing with struct's private part
+9.4k PHP : Get coordinates latitude/longitude from string
+14.6k Golang : How to check if IP address is in range