I am trying to display in a textbox value but it not displaying properly.
I am fetching following code from database
<a href="http://www.test.com" target="_blank">Click Me</a>
When i am displaying value in textbox it displays like
<input type="text" target="_blank" www.test.com"="" http:="" value="<a href=" id="action_url" name="action_url">
Some characters in HTML have special meaning, at least in some context.
"for example means “start an attribute value” or “end an attribute value”.You have
"in your data, so it will end thevalueattribute’s value when encountered.If you want to have
"meaning “A quote mark as data” instead of “End of an attribute value” then you need to express it with the character reference".The PHP function
htmlspecialchars($string)will convert most characters with special meaning in HTML to their equivalent character references. (The second argument to that function will modify which characters are converted, so you can specify that all characters with special meaning will be changed).Any time you have some text that you are inserting into an HTML document, you must run
htmlspecialcharsover it first.