Jump to content

Archived

This topic is now archived and is closed to further replies.

9999

php and iframe

Recommended Posts

If I have a php file:

[code]<?php

//60 or 70 lines of php code here

?>[/code]

How would I put this in an iframe?

I tried the following which didn't work

[code]<iframe src= <?php

//60 or 70 lines of php code here

?>
</iframe>[/code]

Share this post


Link to post
Share on other sites
an iframe doesn't hold code, it opens up a seperate outside page. if your looking to put the PHP code in some kind of small, scrollable box, you should look into CSS.

Share this post


Link to post
Share on other sites
Could I declare the entire php code block a function then put that function name in the src of the iframe

Share this post


Link to post
Share on other sites
No. Try using this code (borrowed from a quick google search)

[code]
<div style="width: 300px; height: 300px; overflow: auto; padding: 5px">

    <?php

    //60 or 70 lines of php code here

    ?>

</div>
[/code]

Share this post


Link to post
Share on other sites
iframe is to my knowledge(which is not alot) used to load a page within a page so it would look something like this

IFRAME File
[quote]<iframe src="The page you need to load.php></iframe>[/quote]

PHP File
[quote]<?php The lines of your code in this page ?>[/quote]

Share this post


Link to post
Share on other sites
Thank you kindly Jocka.

angelb0y:  Yes, that is the function of the iframe.  What I did was, I took "myphpfile.php" and put that code directly into my "index.php" page so I was not able to call it as I normally would.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.