Probllem with PHP and IFrame

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mzfp2
Forum Contributor
Posts: 137
Joined: Mon Nov 11, 2002 9:44 am
Location: UK
Contact:

Probllem with PHP and IFrame

Post by mzfp2 »

Hi,

I am using a template based framework to interface my PHP scripts with HTML output, but have recently run into a problem which I cannot solve.

Normally my PHP templarte scripts will read a template file, and output appropriate content, however I have a function in my code, which calls the output function, the file it should siplay contains an IFRAME, and regardless of irts src property, it only ever displays the host page, soo I get like a recursive effect of Iframes loading into themselves,

I have tried using ob_flush, flush and even Header redirect, but it doesn't seem to workk :

Hope the above makes sense.

Kind Regards
User avatar
aerodromoi
Forum Contributor
Posts: 230
Joined: Sun May 07, 2006 5:21 am

Re: Probllem with PHP and IFrame

Post by aerodromoi »

mzfp2 wrote:Hi,

I am using a template based framework to interface my PHP scripts with HTML output, but have recently run into a problem which I cannot solve.

Normally my PHP templarte scripts will read a template file, and output appropriate content, however I have a function in my code, which calls the output function, the file it should siplay contains an IFRAME, and regardless of irts src property, it only ever displays the host page, soo I get like a recursive effect of Iframes loading into themselves,

I have tried using ob_flush, flush and even Header redirect, but it doesn't seem to workk :

Hope the above makes sense.

Kind Regards
Looks like a variable got mixed up.

Code: Select all

if (empty($script)) $answer= $guess;
aerodromoi
mzfp2
Forum Contributor
Posts: 137
Joined: Mon Nov 11, 2002 9:44 am
Location: UK
Contact:

Post by mzfp2 »

Sorry. here is the code ...

Code: Select all

Function ProfileUpdate()
{

    $Table = New DataInterface();
    $str_Query = "SELECT * FROM users_pending
                  WHERE username LIKE '$username'
                  AND activated LIKE '1'
                  ";
    $Table->DoQuery($str_Query);
    $row = mysql_fetch_array($Table->result);
    if (mysql_num_rows($Table->result) <= 0) return false;
    else
    {
        //Redirect('',"$server_name/db/interface/registra.php?Action=ProfileContinue");
        header("Location: http://myhost/db/interface/registra.php?Action=ProfileContinue");
    }
}
Registra.php loads the template for updating the profile, this usually works fine, but because I am calling thhe function within the script, it seems to be upsetting the IFRame that is in the template!
mzfp2
Forum Contributor
Posts: 137
Joined: Mon Nov 11, 2002 9:44 am
Location: UK
Contact:

Post by mzfp2 »

I also forgot too mention that if type the address above direct the address bar

myhost/db/interface/registra.php?Action=ProfileContinue

Things work ok
User avatar
aerodromoi
Forum Contributor
Posts: 230
Joined: Sun May 07, 2006 5:21 am

Post by aerodromoi »

mzfp2 wrote:I also forgot too mention that if type the address above direct the address bar

myhost/db/interface/registra.php?Action=ProfileContinue

Things work ok
Right now the only thing I see is:
Parse error: parse error, unexpected $ in /home/alljammcom/public_html/db/interface/registra.php on line 140

What's the code for the Iframe itself?

aerodromoi
mzfp2
Forum Contributor
Posts: 137
Joined: Mon Nov 11, 2002 9:44 am
Location: UK
Contact:

Post by mzfp2 »

Hi

many thanks for your reply, the error is due to me mucking about with the script.

I have managed to narrow down the problem to a very specific line of code :

Code: Select all

print "<iframe src='http://someurl.com' width='200' height='200'></iframe>
If I place this in a script and is called directly from the address bar of my browser, it will work fine.
If however I call it from another script (I call the function containing that code) it will fail to load the src, instead it loads the current page within itself

I hope that helps ...
User avatar
aerodromoi
Forum Contributor
Posts: 230
Joined: Sun May 07, 2006 5:21 am

Post by aerodromoi »

mzfp2 wrote:Hi

many thanks for your reply, the error is due to me mucking about with the script.

I have managed to narrow down the problem to a very specific line of code :

Code: Select all

print "<iframe src='http://someurl.com' width='200' height='200'></iframe>
If I place this in a script and is called directly from the address bar of my browser, it will work fine.
If however I call it from another script (I call the function containing that code) it will fail to load the src, instead it loads the current page within itself

I hope that helps ...
Sorry, but that doesn't yet make sense to me :(
You've got a function which prints out the string posted above (btw: you should close the string/the print function as well).
As the url is hardcoded into the string the error must be somewhere else.

aerodromoi
Post Reply