Display 2 graphs in a window

Hi there, I am currently have 2 graphs which display different data. I would like to join them together into only one window. Which means, I
can view 2 graphs with just one click.

Here’s are code which I trying to do but not working


// First Graph
<?php
 $gpa11=$_REQUEST['gpa11'];
 $gpa12=$_REQUEST['gpa12'];
		
 $gpa21=$_REQUEST['gpa21'];
 $gpa22=$_REQUEST['gpa22'];

 $gpa31=$_REQUEST['gpa31'];
 $gpa32=$_REQUEST['gpa32'];

 $gpa41=$_REQUEST['gpa41'];
 $gpa42=$_REQUEST['gpa42'];

 $gpa51=$_REQUEST['gpa51'];
 $gpa52=$_REQUEST['gpa52'];

 if ($gpa11=="-")
 $null11="";
 else
 $null11=$_REQUEST['gpa11'];

  if ($gpa12=="-")
 $null12="";
 else
 $null12=$_REQUEST['gpa12'];

if ($gpa21=="-")
 $null="";
 else
 $null21=$_REQUEST['gpa21'];

 if ($gpa22=="-")
 $null22="";
 else
 $null22=$_REQUEST['gpa22'];

 if ($gpa31=="-")
 $null31="";
 else
 $null31=$_REQUEST['gpa31'];

 if ($gpa32=="-")
 $null32="";
 else
 $null32=$_REQUEST['gpa32'];

 if ($gpa41=="-")
 $null41="";
 else
 $null41=$_REQUEST['gpa41'];

 if ($gpa42=="-")
 $null42="";
 else
 $null42=$_REQUEST['gpa42'];

 if ($gpa51=="-")
 $null51="";
 else
 $null51=$_REQUEST['gpa51'];

 if ($gpa52=="-")
 $null52="";
 else
 $null52=$_REQUEST['gpa52'];
?>
<?php // content="text/plain; charset=utf-8"
require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_bar.php');

$data1y=array($null11,$null21,$null31,$null41,$null51);
$data2y=array($null12,$null22,$null32,$null42,$null52);

// Create the graph. These two calls are always required
$graph = new Graph(800,650);
$graph->SetScale('textlin',0,4);

$theme_class=new UniversalTheme;
$graph->SetTheme($theme_class);

$graph->yaxis->SetTickPositions(array(0,1,2,3,4), array(0.5,1.5,2.5,3.5));
$graph->SetBox(false);

$graph->ygrid->SetFill(false);
$graph->xaxis->SetTickLabels(array('Year 1','Year 2','Year 3','Year 4','Year 5'));
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);

// Create the bar plots
$b1plot = new BarPlot($data1y);
$b2plot = new BarPlot($data2y);

// Create the grouped bar plot
$gbplot = new GroupBarPlot(array($b1plot,$b2plot));
// ...and add it to the graPH
$graph->Add($gbplot);

$b1plot->SetFillGradient("#00FFFF","white",GRAD_LEFT_REFLECTION);
$b2plot->SetFillGradient("#0000FF","white",GRAD_LEFT_REFLECTION);

$b1plot->SetLegend("Semester 1");
$b2plot->SetLegend("Semester 2");

$b1plot->SetColor("white");
$b1plot->SetFillColor("#00FFFF");
$b1plot->value->SetFormat('%01.2f');
$b1plot->value->Show();
$b1plot->SetShadow('gray','1');

$b2plot->SetColor("white");
$b2plot->SetFillColor("#0000FF");
$b2plot->value->SetFormat('%01.2f');
$b2plot->value->Show();
$b2plot->SetShadow('gray','1');

$graph->title->Set("GPA Performance Graph");
$graph->title->SetFont(FF_ARIAL,FS_BOLD,20);
$graph->xaxis->title->Set("Academic Year");
$graph->xaxis->title->SetFont(FF_VERDANA,FS_BOLD,12);
$graph->yaxis->title->Set("Grade Point");
$graph->yaxis->title->SetFont(FF_VERDANA,FS_BOLD,12);
$graph->yaxis->title->SetMargin(3.5);

// Display the graph
$graph->Stroke();
SetMargin($rm);
?>

// Second Graph
<?php
 $cgpa11=$_REQUEST['cgpa11'];
 $cgpa12=$_REQUEST['cgpa12'];
		
 $cgpa21=$_REQUEST['cgpa21'];
 $cgpa22=$_REQUEST['cgpa22'];

 $cgpa31=$_REQUEST['cgpa31'];
 $cgpa32=$_REQUEST['cgpa32'];

 $cgpa41=$_REQUEST['cgpa41'];
 $cgpa42=$_REQUEST['cgpa42'];

 $cgpa51=$_REQUEST['cgpa51'];
 $cgpa52=$_REQUEST['cgpa52'];

 if ($cgpa11=="-")
 $null11="";
 else
 $null11=$_REQUEST['cgpa11'];

  if ($cgpa12=="-")
 $null12="";
 else
 $null12=$_REQUEST['cgpa12'];

if ($cgpa21=="-")
 $null="";
 else
 $null21=$_REQUEST['cgpa21'];

 if ($cgpa22=="-")
 $null22="";
 else
 $null22=$_REQUEST['cgpa22'];

 if ($cgpa31=="-")
 $null31="";
 else
 $null31=$_REQUEST['cgpa31'];

 if ($cgpa32=="-")
 $null32="";
 else
 $null32=$_REQUEST['cgpa32'];

 if ($cgpa41=="-")
 $null41="";
 else
 $null41=$_REQUEST['cgpa41'];

 if ($cgpa42=="-")
 $null42="";
 else
 $null42=$_REQUEST['cgpa42'];

 if ($cgpa51=="-")
 $null51="";
 else
 $null51=$_REQUEST['cgpa51'];

 if ($cgpa52=="-")
 $null52="";
 else
 $null52=$_REQUEST['cgpa52'];

?>
<?php // content="text/plain; charset=utf-8"
require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_bar.php');

$data1y=array($null11,$null21,$null31,$null41,$null51);
$data2y=array($null12,$null22,$null32,$null42,$null52);



// Create the graph. These two calls are always required
$graph = new Graph(800,650,'auto');
$graph->SetScale("textlin");

$theme_class=new UniversalTheme;
$graph->SetTheme($theme_class);

$graph->yaxis->SetTickPositions(array(0,1,2,3,4), array(0.5,1.5,2.5,3.5));
$graph->SetBox(false);

$graph->ygrid->SetFill(false);
$graph->xaxis->SetTickLabels(array('Year 1','Year 2','Year 3','Year 4','Year 5'));
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);

// Create the bar plots
$b1plot = new BarPlot($data1y);
$b2plot = new BarPlot($data2y);

// Create the grouped bar plot
$gbplot = new GroupBarPlot(array($b1plot,$b2plot));
// ...and add it to the graPH
$graph->Add($gbplot);

$b1plot->SetFillGradient("#00FFFF","white",GRAD_LEFT_REFLECTION);
$b2plot->SetFillGradient("#0000FF","white",GRAD_LEFT_REFLECTION);

$b1plot->SetLegend("Semester 1");
$b2plot->SetLegend("Semester 2");

$b1plot->SetColor("white");
$b1plot->SetFillColor("#00FFFF");
$b1plot->value->SetFormat('%01.2f');
$b1plot->value->Show();
$b1plot->SetShadow('gray','1');

$b2plot->SetColor("white");
$b2plot->SetFillColor("#0000FF");
$b2plot->value->SetFormat('%01.2f');
$b2plot->value->Show();
$b2plot->SetShadow('gray','1');

$graph->title->Set("CGPA Performance Graph");
$graph->title->SetFont(FF_ARIAL,FS_BOLD,20);
$graph->xaxis->title->Set("Academic Year");
$graph->xaxis->title->SetFont(FF_VERDANA,FS_BOLD,12);
$graph->yaxis->title->Set("Grade Point");
$graph->yaxis->title->SetFont(FF_VERDANA,FS_BOLD,12);
$graph->yaxis->title->SetMargin(3.5);

// Display the graph
$graph->Stroke();
SetMargin($rm);
?>

Please advise. Thank You.

My advice would be not to try to generate the images at the page level.

<img src=‘graph.php?data1=X&data2=y…’><img src='graph.php?..>