Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8205415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T08:13:52+00:00 2026-06-07T08:13:52+00:00

I am having trouble finding the correct syntax for escape characters and echoing or

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T08:13:53+00:00Added an answer on June 7, 2026 at 8:13 am

    You need to escape double quotes using backslashes, or you can use single quotes as well.

    In your version, the if block is absolutely fine. Similar to that you need to correct the else block as well by escaping double quotes \" like shown here,

    $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>";
    }
    

    Using single quotes:

    $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>';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having trouble finding the correct syntax for creating a Definition List via Perl to
I am new to python and am having trouble finding the correct syntax to
I'm having trouble finding the right syntax to replace an array of objects nested
I'm having trouble finding out the proper syntax for selecting from a table all
I'm having trouble finding a correct regex to achieve what I want. I have
I am having trouble and need some help finding a correct SQL query. Here
I'm having trouble finding examples of the correct way to use NSError , UIAlertView
I am having trouble finding the correct refactor option for the following scenario: I
I'm having trouble finding the correct centre of the QScrollBar's slider (I need to
I'm having trouble finding the correct setting for HTML Purifier 4.3.0 to convert diacritics

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.