- This topic is empty.
February 15, 2012 at 5:51 pm #36676
I make this
echo $val ;
$val will display HTML code by user like this code
but image not appear and display this
http://localhost/wp/%5C%22http://localhost/val.jpg%5C%22February 15, 2012 at 6:16 pm #96769
I would guess that the user HTML code is not being escaped and unescaped correctly when it is being stored. Are you storing it in a database and if so are you handing the strings correctly with addslashes() or mysql_real_escape_string() before storing and then unescaping them afterwards before echoing them out? Or are you sending them as a get variable and then not using urldecode()?
It looks like a combination of both has happened – i.e. that result looks like it has first been escaped and then url encodedFebruary 15, 2012 at 7:11 pm #96770
No I don’t use database , I am getting HTML code from textarea content will user putFebruary 15, 2012 at 8:01 pm #96773
so the user is posting it with a form? what’s the rest of your code?February 15, 2012 at 9:04 pm #96775
I want only make variable display HTML code correctlyFebruary 15, 2012 at 11:11 pm #96785
sorry but you are not providing enough information to tell you why that is happening.
PHP is a pre processing language, your user input must be getting to the php somehow, either by being passed as a GET or POST variable, or by being recalled from a database.
How is the $var variable being set? and how is it being read to generate your unwanted output?
Need to see all the code to figure that out, what you have provided isn’t enough.February 16, 2012 at 4:44 am #96792
it is not script , it is options page for wp theme
and i make textarea for putting analytical code and then i use echo to print it in footerFebruary 16, 2012 at 9:34 am #96808
It is the same problem I face
but when I use code for solution give me error
echo stripslashes(get_settings('content')February 16, 2012 at 10:09 am #96818
I have been used htmlentities() and htmlspecialchare()
but both of them display HTML code like text not give it’s function for displaying imageFebruary 16, 2012 at 3:57 pm #96834
thx but still not workingFebruary 17, 2012 at 8:08 am #96881
- The forum ‘Back End’ is closed to new topics and replies.