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? Link to comment https://forums.phpfreaks.com/topic/76433-solved-htmlspecialchars-problem/ 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. Link to comment https://forums.phpfreaks.com/topic/76433-solved-htmlspecialchars-problem/#findComment-387072 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 Link to comment https://forums.phpfreaks.com/topic/76433-solved-htmlspecialchars-problem/#findComment-387074 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. Link to comment https://forums.phpfreaks.com/topic/76433-solved-htmlspecialchars-problem/#findComment-387077 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.