0

I have a PHP variable, $id, which I previously retrieved in PHP code. This variable needs to be added to a string in HTML tags, like so:

<iframe width="420" height="345" src="http://www.youtube.com/embed/" ID GOES HERE ></iframe>

However, I have no idea how to do this. Any help is appreciated :)

5
  • 1
    Have you made a basic research before asking ? This is the kind of stuff with bilions of results all over the world. Commented Jul 24, 2014 at 14:57
  • src="http://www.youtube.com/embed/<?php echo $id ?>" Commented Jul 24, 2014 at 14:58
  • @YellowBird I tried to do what is contained in the answers I have been given but I put the PHP tags outside of the string and had no idea what I'd done wrong haha. Commented Jul 24, 2014 at 15:00
  • 1
    @DziNeIT - Generally, if you have tried something that didn't work it's a good idea to show what you have tried so people know you have put some effort into it first. Just provides some clarity really. Commented Jul 24, 2014 at 15:02
  • @webnoob Point taken - will do in the future. Commented Jul 24, 2014 at 15:04

1 Answer 1

6

This should do assuming your page is a .php page.

<iframe width="420" height="345" src="http://www.youtube.com/embed/<?php echo $id; ?>"></iframe>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.