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
+8.6k Golang : Get final balance from bit coin address example
+12.4k Golang : Send data to /dev/null a.k.a blackhole with ioutil.Discard
+62.4k Golang : Convert HTTP Response body to string
+18.2k Golang : Logging with logrus
+7.2k Golang : Process json data with Jason package
+15.4k Golang : Get checkbox or extract multipart form data value example
+17.4k How to enable MariaDB/MySQL logs ?
+4.2k Golang : Valued expressions and functions example
+7.2k Android Studio : How to detect camera, activate and capture example
+4.9k Linux/Unix/MacOSX : Find out which application is listening to port 80 or use which IP version
+20.9k Golang : How to force compile or remove object files first before rebuild?
+5.6k Unix/Linux : How to test user agents blocked successfully ?