esoterick Posted October 30, 2007 Share Posted October 30, 2007 I have some php code that generates an iframe inside my current page. http://.../noc/test/gage_test2.php?iSize=500&dSetting=.99&sDisplay=bleh iSize is the size of the iframe dSetting is the value a decimal representation of a precent, and sDisplay is a string representing text that is displayed in the iframe. With common strings everything is great i just get in a jam when i pass in some html. i.e. i want to be able to pass in something like this <a href="bleh.htm">bleh</a>. is there any way around this? as of right now this is what i get as the html output <iframe src="/.../noc/test/gage_test2.php?dSetting=5.1&iSize=300&sDisplay=<a class="nocHTMLtool_Anchor" href="display_incidents.php" target="_blank" style="font-weight: bold; color: black;">51</a>" width=310px frameborder=no height=25px scrolling=no></iframe> and it gets all confused... would using regex to remove the " and replace them with ' solve this problem or is there an easier way to do something like this. Quote Link to comment https://forums.phpfreaks.com/topic/75295-passing-html-into-a-php-file/ Share on other sites More sharing options...
esoterick Posted October 30, 2007 Author Share Posted October 30, 2007 Bump Quote Link to comment https://forums.phpfreaks.com/topic/75295-passing-html-into-a-php-file/#findComment-381492 Share on other sites More sharing options...
wildteen88 Posted October 30, 2007 Share Posted October 30, 2007 You'll want to use htmlspecialchars or htmlentities if you are passing HTML over the url. Eg: $dSetting = 5.1; $iSize = 300; $sDisplay = '<a class="nocHTMLtool_Anchor" href="display_incidents.php" target="_blank" style="font-weight: bold; color: black;">51</a>'; echo '<iframe src="/.../noc/test/gage_test2.php?dSetting=' . $dSetting . '&iSize=' . $iSize . '&sDisplay=' . htmlentities($sDisplay, ENT_QUOTES) . '"></iframe>'; Quote Link to comment https://forums.phpfreaks.com/topic/75295-passing-html-into-a-php-file/#findComment-381517 Share on other sites More sharing options...
esoterick Posted October 31, 2007 Author Share Posted October 31, 2007 thank you that did the trick Quote Link to comment https://forums.phpfreaks.com/topic/75295-passing-html-into-a-php-file/#findComment-381645 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.