PHP and iframe doesnt work

  • baligena
  • Novice
  • Novice
  • baligena
  • Posts: 25

Post 3+ Months Ago

It seems that iframe doesn't work on a php file. Why is that?
  • Zealous
  • Guru
  • Guru
  • User avatar
  • Posts: 1244
  • Loc: Sydney

Post 3+ Months Ago

Can you post the code, we are not mind readers :)
  • baligena
  • Novice
  • Novice
  • baligena
  • Posts: 25

Post 3+ Months Ago

file is basic.php


<html>

<body>
<?php
echo "hello world";
?>

<iframe src="domain goes here" height="500" width="500"></iframe>
<body>
<html>






notes: the content in the iframe will not show

---------------------------------------
For my blog Google search: Serpa Studio
  • Zealous
  • Guru
  • Guru
  • User avatar
  • Posts: 1244
  • Loc: Sydney

Post 3+ Months Ago

Just to test it to double check it worked i have taken it and saved it as test.php in the main directory in my main site on my computer.

iframed the index and open and i can not see anything wrong with the code at all

Code: [ Select ]
<html>

<body>
<?php
echo "hello world";
?>

<iframe src="index.html" height="500" width="500"></iframe>
<body>
<html>
  1. <html>
  2. <body>
  3. <?php
  4. echo "hello world";
  5. ?>
  6. <iframe src="index.html" height="500" width="500"></iframe>
  7. <body>
  8. <html>


Worked for me fine, i am not sure why it does not work for you.

also use CODE bbtags when posting code too, to make life easy :)
  • baligena
  • Novice
  • Novice
  • baligena
  • Posts: 25

Post 3+ Months Ago

it works when the iframe src is in your directory but why doesnt work when it a external website example below
Code: [ Select ]
<html>
<body>
<?php
  echo "hello world";
?>
<iframe src="http://youtube(dot)com" height="500" width="500"></iframe>
</body>
</html>
  1. <html>
  2. <body>
  3. <?php
  4.   echo "hello world";
  5. ?>
  6. <iframe src="http://youtube(dot)com" height="500" width="500"></iframe>
  7. </body>
  8. </html>
  • Zealous
  • Guru
  • Guru
  • User avatar
  • Posts: 1244
  • Loc: Sydney

Post 3+ Months Ago

i am starting to think you don't look at your code at all, but once again i slap your code in add the src and open in firefox and it works.

once again here is the code that i used.
Code: [ Select ]
<html>

<body>
<?php
echo "hello world";
?>

<iframe src="http://www.youtube[dot]com" height="500" width="500"></iframe>
<body>
<html>
  1. <html>
  2. <body>
  3. <?php
  4. echo "hello world";
  5. ?>
  6. <iframe src="http://www.youtube[dot]com" height="500" width="500"></iframe>
  7. <body>
  8. <html>
  • baligena
  • Novice
  • Novice
  • baligena
  • Posts: 25

Post 3+ Months Ago

I tried it in firefox and it didn't work. I dont believe you can you show me a screen shot.
  • Zealous
  • Guru
  • Guru
  • User avatar
  • Posts: 1244
  • Loc: Sydney

Post 3+ Months Ago

that is fine with me, this is the posted code that was placed in dreamweaver CS5 and then F12 to save and open Firefox v3.6.16 then print screen save in mspaint and uploaded here. i can not make it any more simple without making a home video. Can someone please confirm that the code is right because according to this screen shot i am right.

I have no idea what your doing wrong, i don't even have php installed correctly and if php was installed Hello world would turn up at the top of the page but that code in HTML which will work anywhere.

:) Happy coding
Attachments:
screentest.png

this is a direct screen shot just taken with a solid color over my personal information.

  • baligena
  • Novice
  • Novice
  • baligena
  • Posts: 25

Post 3+ Months Ago

it must be because you have the older version of firefox because it doesnt work for me. I have firefox 4. Have you tried it on different browsers like chrome and internet explore
  • Zealous
  • Guru
  • Guru
  • User avatar
  • Posts: 1244
  • Loc: Sydney

Post 3+ Months Ago

o.k, i am going to leave this one for someone else as this command is very simple and should not make a difference, i have no idea why your having a issue with this but it has to be something on your end. all the iframe does is frame another window like Picture in Picture mode on tv's.

i have never encountered such a error so it is beyond me at this point unless another variable is put on the table to figure out the problem at hand.
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • User avatar
  • Posts: 3422
  • Loc: Richland, WA

Post 3+ Months Ago

The below code loads in Chrome 10, Firefox 4 and IE 8 for me.

Code: [ Select ]
<html>
<body>
<?php
 echo "Hello Browser!";
?>
<iframe src="http://google.com" height="500" width="500"></iframe>
</body>
</html>
  1. <html>
  2. <body>
  3. <?php
  4.  echo "Hello Browser!";
  5. ?>
  6. <iframe src="http://google.com" height="500" width="500"></iframe>
  7. </body>
  8. </html>


http://apps.jakwac.com/iframe.php
http://apps.jakwac.com/src/iframe.php

As to your youtube problem: http://groups.google.com/group/youtube- ... a098?pli=1
  • baligena
  • Novice
  • Novice
  • baligena
  • Posts: 25

Post 3+ Months Ago

thanks SpooF. I see why it wasnt working. Youtube doesn't allow iframe. Now is there a way around it??
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • User avatar
  • Posts: 3422
  • Loc: Richland, WA

Post 3+ Months Ago

Why exactly do you want to put youtube into an iframe on your site? Every video can be embedded into a site with the code provided at youtube (With the exception of certain videos do to author copy right).

Post Information

  • Total Posts in this topic: 13 posts
  • Users browsing this forum: No registered users and 33 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.