Hi, I have been trying as you suggested but I got into this issue:
when I put the data into a session variable and try to access this
from the script that generates the graphic; it gets there without
anydata.
I checked if the session has been started already and it is.
The code works well as a standalone but when I try to use it with a
IMG tag it won't work... any suggestion?
Below I include a simplification of the situation, page A is the view
for a particular function in a controller and page B is the script
that uses JpGraph to generate a particular graphic.
Page A
- The relevant data is saved into a session variable.
- I call the script embeded in a IMG tag
if(!isset($_SESSION))
{session_start();}
$_SESSION['x_series'] = $myData;
....
<img src="<?php echo $this->webroot.'graphics/population.php;?>">
Page B
- Copy the session variable to another one.
- Process array with data.
- Generate graphic
- Call stroke function
...
$x_data = $_SESSION['x_series'];
foreach ($x_data as $field)
{
array_push($newArray , array_merge($field['0'],
$field['population_totals']));
}
foreach($newArray as $element)
{
array_push($period,$element['period'] );
array_push($population,$element['population']);
}
// Create the graph. These two calls are always required
$graph = new Graph(300,200,"auto");
$graph->img->SetMargin(40,20,20,40);
...
It is in the first foreach where where I get the following error:
"Invalid argument supplied for foreach", I got the message from the
web server log. Anyway, It's like the variable is getting there empty.
Any suggestions?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---