Thanks sirs for your comments so far. @Mittineague, appreciate your advise greatly, but here in Nigeria, some lecturers believes they are demi-gods and won't listen to any plea whatsoever.
About the project, I have been able to create a way to populate database data on the browser as in form a report whereby users can then query it and get the limited data they want on the browser through the help of some tutorials gotten.
With the graph, i then intend that the user enters the data from the query into the form themselves. However, I am having issues to get the script pull from the form. @Cups, I used the get method as suggested and without the graph script, the form is working with the exception of the textarea field.
Please i need help as to how to get this final stage to work as this is almost the final stage of my project.
Many Thanks. My code is below:
PHP Code:
<?php
if(isset($_GET['submit']))
{
$title = (int)$_GET['title'];
$legend = (int)$_GET['legend'];
}
// content="text/plain; charset=utf-8"
// Example for use of JpGraph,
// ljp, 01/03/01 20:32
require_once ('../jpgraph.php');
require_once ('../jpgraph_bar.php');
// We need some data
$datay=array(-0.36,0.25,-0.21,0.43,0.31,0.04,-0.23,0.031,0.29,-0.08,0.07,0.19);
// Setup the graph.
$graph = new Graph(1000,400);
$graph->img->SetMargin(60,150,30,50);
$graph->SetScale("textlin");
$graph->SetMarginColor("silver");
$graph->SetShadow();
// Set up the title for the graph
$graph->title->Set("$title");
$graph->title->SetFont(FF_VERDANA,FS_NORMAL,16);
$graph->title->SetColor("darkred");
// Setup font for axis
$graph->xaxis->SetFont(FF_VERDANA,FS_NORMAL,10);
$graph->yaxis->SetFont(FF_VERDANA,FS_NORMAL,10);
// Show 0 label on Y-axis (default is not to show)
$graph->yscale->ticks->SupressZeroLabel(false);
// Setup X-axis labels
$graph->xaxis->SetTickLabels($gDateLocale->GetShortMonth());
$graph->xaxis->SetLabelAngle(50);
// Set X-axis at the minimum value of Y-axis (default will be at 0)
$graph->xaxis->SetPos("min"); // "min" will position the x-axis at the minimum value of the Y-axis
// Create the bar pot
$bplot = new BarPlot($datay);
$bplot->SetWidth(0.6);
$bplot->SetLegend("$legend","blue");
// Setup color for gradient fill style
$bplot->SetFillGradient("navy","steelblue",GRAD_MIDVER);
// Set color for the frame of each bar
$bplot->SetColor("navy");
$graph->Add($bplot);
// Finally send the graph to the browser
$graph->Stroke();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<p>
<form id="form1" name="form1" method="get" action="<?= $PHP_SELF ?>">
<label for="title">Graph Title:</label><br/>
<input type="text" name="title" id="title" /><br/><br/>
<label for="legend">Graph Legend:</label><br/>
<input type="text" name="legend" id="legend" /><br/><br/>
<label for="values">Enter X values(seperate with comma):</label><br/>
<textarea name="values" id="values" cols="45" rows="5"></textarea><br/><br/>
<input type="submit" name="generate" id="generate" value="Generate Graph" />
</form>
</p>
</body>
</html>
Bookmarks