Err Posted October 8, 2007 Share Posted October 8, 2007 Not really sure it is in fact ASCII or not. The problem is when I input a < (less than) sign into one of my inputs on my form and PHP displays it, it messes up the code on the page where it is displayed on. For example, I typed in "<dog" into one of my inputs, I press submit and PHP tries to display it. The problem is my code now looks like this: <p><b><dog</b> is not valid.</p> I get all sorts of validation errors. Anyone know how I can change certain HTML symbols like < > into < > and avoid any errors of this kind? Link to comment Share on other sites More sharing options...
zppblood Posted October 8, 2007 Share Posted October 8, 2007 Someone can insert XSS into it too, insert something like <script>alert('XSS')</script>.I prefer this one.Use htmlentities($input, ENT_QUOTES, 'whatever character set you want');http://us.php.net/manual/en/function.htmlentities.phpOr you can usehttp://us.php.net/manual/en/function.htmlspecialchars.php Link to comment Share on other sites More sharing options...
Err Posted October 8, 2007 Author Share Posted October 8, 2007 Thank you for your reply. This has helped me a lot. I should of checked the php site to begin with, lol. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.