I am using ob_* functions to build some content that will be then passed to an HTML template and printed in pdf format with MPDF.
I need to include some contents coming from another php file. The file I need to include will run a query and echo some data in a table based on a id parameter. Normally in my application I use ajax to load this file in the right place but ob_* functions output the data before AJAX can do its stuffs (see my other question on this point) so I am looking for a workaround. The best idea I had is to use php include to do the trick. The code in my mind would look like:
foreach($listaz as $l){
include "bp/businessplan.php?id=$l";
}
Obviously this doesn't work (I am aware of how include works as stated in this SO question) since I get this error:
Warning: include(bp/businessplan.php?id=AZ000000213): failed to open stream: No such file or directory in /var/www/jdev/creditmanager/sofferenze/soff.php on line 1000
$listaz
will contain the list of parameters to pass to the file and the array is like the following:
array(
[0]=>AZ000000213
)
(in this case just one item) So the question is: How do I get to include the content of the businessplan.php file in the main php file as many times as the values in the array printing it in a specific place in the main php file (appending it into a div one after the other)?