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:

  1. src="<? echo $test ?>">

or

  1. src="<?=$test ?>">

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -