LemonInflux Posted November 7, 2007 Share Posted November 7, 2007 I'm using WAMP, XAMPP is set up (localhost). Say we use this example: <?php $new = htmlspecialchars("<a href='test'>Test</a>"); echo $new; ?> for some reason, the code outputs: <a href='test'>Test</a> I looked on php.net, and tried their example; still didn't work. Has anyone had this problem? Anyone any ideas? Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted November 7, 2007 Share Posted November 7, 2007 That is what its suppose to do. Specialchars is designed to escape tags for viewing. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted November 7, 2007 Share Posted November 7, 2007 Take a look at the source of the generated code. Your php script is generating the correct HTML character codes; your browser is rendering them as the correct character. Edit: However, with your present code, nothing would happen anyway. To turn single quotes into ', ENT_QUOTES must be set. See: www.php.net/htmlspecialchars Quote Link to comment Share on other sites More sharing options...
LemonInflux Posted November 7, 2007 Author Share Posted November 7, 2007 oh, duhr >_< Sorry, wasn't thinking properly. Solved. 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.