0

I am in a nasty situation. I am trying to echo an iframe in php based on an if statement. However this returns a blank space.

I think this is due to the wrong escaping [single/double quotation] but can't figure it out :(

My code:

echo '<iframe src="'.$the_iframe_calling_url.'" frameborder="0"></iframe>';

any luck on this?

Okay, here is my code with if block. I am stuck with this :(

//check if this is image or not
    if (($file_type === 'image/gif')or($file_type === 'image/jpeg')or($file_type === 'image/jpg')or($file_type === 'image/pjpeg')or($file_type === 'image/x-png')or($file_type === 'image/png') ){
        echo '<img src="'.$final_file_url.'" width="70%" />';
        }

    else{

    $the_iframe_calling_url = 'https://docs.google.com/viewer?url='.$final_file_url; //http url

    //echo $final_file_url;
    echo '<iframe src="'.$the_iframe_calling_url.'" frameborder="0"></iframe>';


    echo $the_iframe_calling_url;
        }
    }
7
  • 3
    You're going to have to add more code. At the very least, you need to give us the if statement and the definition of $the_iframe_calling_url. What does the outputted HTML look like? Commented Oct 25, 2013 at 16:28
  • $the_iframe_calling_url is perfectly okay. the value of $the_iframe_calling_url is docs.google.com/viewer?url=http://acssales.net/data/uploads/… and it is a valid link Commented Oct 25, 2013 at 16:33
  • OK. So what is your code outputting? Can you add the rendered HTML to your question? Is the echo even being called? Commented Oct 25, 2013 at 16:34
  • @andrewsi: My code is outputting a blank iframe box :( but this should contain the targeted data from URL. Commented Oct 25, 2013 at 16:35
  • Look at the source of the page you're generating. What is the src attribute for your <iframe>? Is it correct, or not? Commented Oct 25, 2013 at 16:38

1 Answer 1

2

There is nothing wrong with your code. Maybe the url your are trying to open is the problem. $the_iframe_calling_url

Or the if statement that was said in the comment

Since you posted the URL you are trying to show in an Iframe here is your answer:

Iframe google problem

Sign up to request clarification or add additional context in comments.

1 Comment

this is the reason!! I get it. Thank you so very much Jorge :)

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.