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
+5.4k Clean up Visual Studio For Mac installation failed disk full problem
+6.7k Golang : Find the longest line of text example
+29.4k Golang : How to create new XML file ?
+38k Golang : Read a text file and replace certain words
+6.8k Default cipher that OpenSSL used to encrypt a PEM file
+5.2k Responsive Google Adsense
+50.9k Golang : Disable security check for HTTPS(SSL) with bad or expired certificate
+22.1k Golang : Repeat a character by multiple of x factor
+16.5k Golang : Delete files by extension
+46.1k Golang : Read tab delimited file with encoding/csv package
+8k Golang : Handle Palindrome string with case sensitivity and unicode
+6.9k Golang : Fibonacci number generator examples