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.2k Golang : How To Use Panic and Recover
+7.9k Golang : Get curl -I or head data from URL example
+7.2k Golang : Find relative luminance or color brightness
+6.1k Golang : Get Alexa ranking data example
+5.5k Golang : Convert an executable file into []byte example
+10.9k Golang : Simple client-server HMAC authentication without SSL example
+4.7k Python : Print unicode escape characters and string
+40.8k Golang : Convert []byte to image
+12.6k Golang : Human readable time elapsed format such as 5 days ago
+18k Golang : Check if directory exist and create if does not exist
+4.5k Golang : Return multiple values from function
+5.1k PHP : How to check if an array is empty ?