I am having trouble finding the right syntax for escape characters and echo or filter the iframe output in PHP.
$ youtube = $ _SESSION ['SESS_YOUTUBE']; If ($ _ session ['SESS_YOUTUBE'] == '') {Print " Can someone point me in the right direction, or can I provide useful links to explain the escapeable characters?
Thank you.
You need to avoid double quotes using backslashes, or you can also use single quotes You can.
In your version, the if block is perfectly fine. Similarly, you must fix the else block by avoiding duplicate quotes, as shown here, $ youtube = $ _SESSION ['SESS_YOUTUBE']; If ($ _ session ['SESS_YOUTUBE'] == '') {print " $ youtube = $ _SESSION ['SESS_YOUTUBE']; If ($ _SESSION ['SESS_YOUTUBE'] == '') {Print '& lt; Div class = "someclass" & gt; Some text here & lt; / Div> ';} else {print' & lt; Iframe id = "player" width = "425" height = "350" src = "http://www.youtube.com/embed/$youtube" frameborder = "0" & gt; & Lt; / Iframe & gt; ';}
Comments
Post a Comment