Jump to content

Greater Than/less Than Signs In Php Variables


niche

Recommended Posts

Please, I want this script:<?php$options = "";$thing = "Sports";$options.="<OPTION>".$thing. "</option>";echo $options;?>to echo: <OPTION>Sports</option>How do I escape the greater than / less than signs? I'm trying to build a drop down menu from a MYSQL table.Thanks

Link to comment
Share on other sites

You encode them as entities, either manually or by using htmlspecialchars().

<?php$options = "";$thing = "Sports";$options.="<OPTION>".$thing. "</option>";echo htmlspecialchars($options);?>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...