html - How can I use a PHP variable inside an iframe? -
i'm having problem i'm trying use $test
variable inside iframe in src
section , each time try fail , black border shows up.
here code:
<?php $url = 'http://www.youtube.com/watch?v=9t5itwlwydg/'; $parts = explode('=', $url); $url2 = $parts[1]; $url3 = trim($url2,"?\/"); echo $url3; $youtube = 'http://www.youtube.com/v/'; $video = $url3; $vars = '&loop=1&autoplay=1'; $test = ($youtube . $video . $vars); echo $test; ?> <br> <iframe width="420" height="345" src="<? $test ?>"> </iframe>
you must use echo like:
src="<? echo $test ?>">
or
src="<?=$test ?>">
Comments
Post a Comment