ricmetal Posted September 1, 2013 Share Posted September 1, 2013 hi yall how can i escape php variables inside a html attribute, being echoed with php? like follows: echo "<img title=' " . $ls_cb_title . " '>"; Quote Link to comment Share on other sites More sharing options...
requinix Posted September 1, 2013 Share Posted September 1, 2013 htmlspecialchars or htmlentities. Be aware of the ENT_QUOTES setting (apostrophes are not encoded by default) and the character set parameter (as they both assume ISO 8859-1 unless told otherwise). Consider writing your own function that calls either using the correct arguments - that way you don't have to remember to do that yourself every time. Quote Link to comment Share on other sites More sharing options...
ricmetal Posted September 1, 2013 Author Share Posted September 1, 2013 (edited) cool. thanks for that. Edited September 1, 2013 by ricmetal Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.