I have a form. You enter text, and it is posted onto a website. However, for symbols such as & and £ I need to have the coded versions so that they display properly accross all browsers. Do you know how to do this? I have written a function which adds BR tags for line breaks and also used one which removed the problematic \ which are added before quote marks (so they don't show on the site). However, I just can't figure out how to do this bit so that all such characters come up as HTML! Any ideas?
Do you mean something like this? http://us2.php.net/manual/en/function.htmlentities.php It looks like this one could be better, I don't really use PHP so I'm not sure which is best. http://us2.php.net/manual/en/function.htmlspecialchars.php
Yeah, it's something like that. Except when I use it, it actually ends up spitting out the same characters in the end. I have NO idea why it does this. I will try and look into it again. Thanks for the help.
So you want to update your custom function and use it instead of the built in function? If so post your code so I can look at it.
If you're passing the entity in a form, then the URLencode makes the characters parse out as regular characters. You may have to switch the code to NOT ACCEPT url-encoded characters. It's not really PHP, I don't think, I think it's the form that sends it that way through the browser. Best yet, post the part of the page that does that like DrLudicrous said.