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
+7.8k Golang : get the current working directory of a running program
+15.6k Golang : Get all local users and print out their home directory, description and group id
+7.1k Golang : Calculate BMI and risk category
+29k Golang : Detect (OS) Operating System
+8.6k Your page has meta tags in the body instead of the head
+19.2k Golang : Clearing slice
+13k Golang : Listen and Serve on sub domain example
+14k Golang : unknown escape sequence error
+6.9k Golang : When to use make or new?
+12.1k Golang : GTK Input dialog box examples
+22.5k Golang : Read directory content with filepath.Walk()