I am having trouble finding the correct syntax for escape characters and echoing or printing an iframe output in PHP.
$youtube = $_SESSION['SESS_YOUTUBE'];
if($_SESSION['SESS_YOUTUBE'] == '')
{
print "<div class=\"someClass\">Some Text Here</div>";
}
else
{
print "<iframe id="player" width="425" height="350" src="http://www.youtube.com/embed/$youtube" frameborder="0"></iframe>";
}
Could someone please point me in the right direction or provide me with a useful link for explaining escape characters?
Thank you.
You need to escape double quotes using backslashes, or you can use single quotes as well.
In your version, the
ifblock is absolutely fine. Similar to that you need to correct theelseblock as well by escaping double quotes\"like shown here,Using single quotes: