Minklet Posted September 25, 2010 Share Posted September 25, 2010 I need to echo out a database value that contains an embed code for soundcloud (music hosting site), into a value of a text input. How do I do this without the object getting rendered? This is an example of an embed code. <object height="81" width="100%"> <param value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fsoundcloud.com%2Fgeneralpie%2Fdukebox001&secret_url=false" name="movie"> <param value="always" name="allowscriptaccess"> <embed height="81" width="100%" type="application/x-shockwave-flash" src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fsoundcloud.com%2Fgeneralpie%2Fdukebox001&secret_url=false" allowscriptaccess="always"> </object> The value has to stay exactly the same so that it can pass a regular expression for validation. Is this possible? Link to comment https://forums.phpfreaks.com/topic/214392-echoing-out-embed-codes/ Share on other sites More sharing options...
joel24 Posted September 26, 2010 Share Posted September 26, 2010 use htmlentities() *edit: if you want it exactly the same, i.e. not translated with HTML entities, you can wrap the input value in single quotes and ensure none are in the string, or vice-versa i.e. $test = '<object height="81" width="100%"> <param value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fsoundcloud.com%2Fgeneralpie%2Fdukebox001&secret_url=false" name="movie"> <param value="always" name="allowscriptaccess"> <embed height="81" width="100%" type="application/x-shockwave-flash" src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fsoundcloud.com%2Fgeneralpie%2Fdukebox001&secret_url=false" allowscriptaccess="always"> </object>'; //html, ensure to wrap in single quotes as $test string contains double quotes. <input type='text' value='<?php echo $test; ?>' /> Link to comment https://forums.phpfreaks.com/topic/214392-echoing-out-embed-codes/#findComment-1115664 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.