OllieStanley
OllieStanley

Reputation: 722

Adding a PHP variable to HTML code

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 :)

Upvotes: 0

Views: 110

Answers (1)

webnoob
webnoob

Reputation: 15934

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>

Upvotes: 6

Related Questions