php - correct syntax to echo variable inside iframe -


i know missing simple. want display iframe if $video-code exists. can see wrong this? working in wordpress. error on echo line. i've tried adding .'$video-code'. url.

it displaying iframe correctly, variable displaying text in url. if call variable elsewhere in page without if statement, displays correctly.

thanks help!

<?php $key = 'video-code'; $themeta = get_post_meta($post->id, $key, true); if($themeta != '') { echo '<iframe id="player" width="560" height="315" frameborder="2"     src="http://www.youtube.com/embed/$video-code" ></iframe>'; }?> 

you can concatenate $key, so:

echo '<iframe id="player" width="560" height="315" frameborder="2"  src="http://www.youtube.com/embed/' . $key . '" ></iframe>'; 

Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -