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
+9.1k Golang : Convert(cast) bigint to string
+11.4k Android Studio : Use image as AlertDialog title with custom layout example
+7.3k Golang : Go as a script or running go with shebang/hashbang style
+5.2k Golang : How to stop user from directly running an executable file?
+14.4k Golang : Send email and SMTP configuration example
+12.3k Golang : Adding XML attributes to xml data or use attribute to differentiate a common tag name
+4.6k Golang : Find the longest line of text example
+6k Golang : Reverse a string with unicode
+7k Golang : Scramble and unscramble text message by randomly replacing words
+8.6k Golang : Calculate Relative Strength Index(RSI) example
+8.9k Golang : Removes punctuation or defined delimiter from the user's input
+14.2k Golang : Get future or past hours, minutes or seconds