I have a .php page already set up. Now I'm looking at trying to load that php file into a div tag of a certain size on another page. What code do i have to put into the div tag to make it work?
How Do I load php into an div tag on another page?
You need to make the file that has the div tag a php file too
Then do something like this
%26lt;div%26gt;
%26lt;?php include("other-php-file.php"); ?%26gt;
%26lt;/div%26gt;
Reply:As others have said, it's easiest if the other page is also PHP, because then you can just use an include statement.
The emerging answer is to use AJAX for this problem. Have your container page use an AJAX library (like jQuery) to make a request of your PHP program, and place the results directly in your div. The advantage of the AJAX approach is you can have the contents of the div change in real time without having to re-create the entire page.
Good luck!
Reply:You can use a php include, but both pages have to be php. Example:
page2.php :
%26lt;div style="position:absolute;"%26gt;
%26lt;?php include('page1.php'); ?%26gt;
%26lt;/div%26gt;
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment