I was provided with a set of data that represents URL links. Such as: "doug'sfood.jpg".
.
I keep these strings in an array, and then select them randomly to display inserting them into an
<img src="doug'sfood.jpg"></img>
What Chrome is putting out is:
<img src="doug'sfood.jpg"></img>
I tried replacing the quotes with a php escaped (\') apostrophe, but this just ended the quote prematurely.
Can someone help me? Thanks.
I think Chrome automatically escapes characters that are not correctly escaped.
Always use:
Instead of:
Certain characters should always be escaped in HTML, for example:
Check the htmlspecialchars() and urlencode() functions, example: