ShaolinF Posted April 6, 2011 Share Posted April 6, 2011 Hi Guys, I am trying to use htmlentities and htmlspecialchars to convert a ampersand (&) to the html markup eqivalant (&) to no avail. any ideas ? htmlentities("this is & that"); Quote Link to comment https://forums.phpfreaks.com/topic/232820-converting-to-amp/ Share on other sites More sharing options...
dreamwest Posted April 6, 2011 Share Posted April 6, 2011 echo htmlspecialchars("this is & that"); Quote Link to comment https://forums.phpfreaks.com/topic/232820-converting-to-amp/#findComment-1197512 Share on other sites More sharing options...
ShaolinF Posted April 6, 2011 Author Share Posted April 6, 2011 That works outside an input value but not inside. <input value="<? echo htmlspecialchars("this is & that");?>" /> Are there any workarounds other than stripping? Quote Link to comment https://forums.phpfreaks.com/topic/232820-converting-to-amp/#findComment-1197515 Share on other sites More sharing options...
kenrbnsn Posted April 6, 2011 Share Posted April 6, 2011 If you do a show source on the web page, you will see that the & was changed to &. It's just that the browser is display a "&" for the "&" Ken Quote Link to comment https://forums.phpfreaks.com/topic/232820-converting-to-amp/#findComment-1197522 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.