Hi, I am having a real issue with this for weeks now. Basically my php webpage
has img linked to my phplot PieChart.php which displays in image format. I
have set some form variables to be linked to Pie_Chart.php so that it picks up
the variables from my main php file. This has not happened as passed variables
are never recognised and basically comes up as NULL.
Try putting echo in your , and end the line with a
semicolon.
Also, always validate the values you get from a $_GET to make sure hackers
don't take over your computer. If the values are numeric, you can do something
like this:
(0 + $_GET)
Also, the array('a',$_GET,$_GET contains a $_GET that doesn't have a
specified. Not sure if that is what you are attempting to do.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is that the whole form, 2 hidden fields and a submit button, or are there
other fields not shown above? If that is all, you might want to use a plain
link instead instead of a form:
After you made the changes from adoll, and you click the Calculate button,
does the URL in the browser show the correct syntax and parameters? Also as
adoll wrote you need to fix the bare $_GET inside the data array.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you see a chart with the hard coded value in the array, then the trouble is
in the $_GET statements.
If you don't see a chart with the hard coded values, then we need to dig
deeper into the $data array. It wouldn't hurt to do an audit on the contents
of the array like this:
var_dump($data);
What happens when you try these?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry it does have code form name after first $_GET also //Draw it is actually
on top of $graph->DrawGraph(); which is also correct. But I'm not sure about
var_dump($data), is this meant to be included in Pie_Graph.php?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, I have downloaded phplot.php and over-written on the existing file and it
worked!!! But now the problem is that it goes to the does not display on the
Real Estate Analyzer.php page but it displays on Pie_Graph.php. Is there any
way we can display this in the Real Estate Analyzer page?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This will put the img tag below your form, and when somebody clicks Submit,
the page will reload with the graph showing the numbers filled into the form.
Note you have hidden fields for the inputs, so the user can't input numbers.
If you have another page that generates the numbers to plot, you can call the tag from there and not mess around with this form. The way this is set
up, somebody still needs to press a submit button to make it work.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It is now working perfectly. Thank you very much for your support you saved my
life!!!! One question I had was that is there any customized phplot graphs
that I could download so I can use them in some of my future projects? I'm not
sure if there are any nice looking 3D ones around...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, I am having a real issue with this for weeks now. Basically my php webpage
has img linked to my phplot PieChart.php which displays in image format. I
have set some form variables to be linked to Pie_Chart.php so that it picks up
the variables from my main php file. This has not happened as passed variables
are never recognised and basically comes up as NULL.
Below are my codes...
Main PHP:
<form name="form2" action="Pie_Chart.php" method="GET" id="user-content-form2"> <input type="hidden" name="Annual_Expenses" value="<?php $Annual_Expenses ?>"> <input type="hidden" name="Mortgage_Interest" value="<?php $Mortgage_Interest ?>"> <input type="submit" name="Calculate" id="Calculate"> </form>Pie_Chart.php:
SetPlotType("pie"); $legend = array(); //Define some data $data = array( array('a',$_GET,$_GET,5526.09,12000,2805.48) ); $graph->SetDataValues($data); $graph->SetLegendPixels(1,5,false); $graph->SetLegend($legend); //Draw it $graph->DrawGraph(); ?>Anyone have any ideas? If anyone could give me a workable solution, I would
highly appreciate your work!!!
Thank you very much!!!
Try putting echo in your , and end the line with a
semicolon.
Also, always validate the values you get from a $_GET to make sure hackers
don't take over your computer. If the values are numeric, you can do something
like this:
(0 + $_GET)
Also, the array('a',$_GET,$_GET contains a $_GET that doesn't have a
specified. Not sure if that is what you are attempting to do.
Hi adoll, thanks for the reply but it still does not work with echo in it. Is
there any other solutions?
Is that the whole form, 2 hidden fields and a submit button, or are there
other fields not shown above? If that is all, you might want to use a plain
link instead instead of a form:
After you made the changes from adoll, and you click the Calculate button,
does the URL in the browser show the correct syntax and parameters? Also as
adoll wrote you need to fix the bare $_GET inside the data array.
Looking at the code fragments, I can think of a number of possibilities.
First, try hard-coding the array() in Pie_Chart.php and see if it works:
$data = array( array('a',1000 ,5526.09,12000,2805.48) );
If you see a chart with the hard coded value in the array, then the trouble is
in the $_GET statements.
If you don't see a chart with the hard coded values, then we need to dig
deeper into the $data array. It wouldn't hurt to do an audit on the contents
of the array like this:
var_dump($data);
What happens when you try these?
Hi the chart with hardcoded values does work so I think the trouble is in the
$_GET statements...
Is there any other way guys??
First, have you corrected the error in your $data array?
That $_GET isn't right. What is it supposed to be? Perhaps:
Second, what does your $data array look like? What does the var_dump($data)
look like?
Third, this is probably a problem with the way your code is formatted on
Sourceforge, but can you confirm that:
is actually:
(should be a carriage-return separating the // Draw It from the
$graph->DrawGraph();)
Hi adoll, thanks for the prompt reply! The code for the Pie_Chart.php is
SetPlotType("pie"); $legend = array(); //Define some data $data = array( array('a',$_GET,$_GET,5526.09,12000,2805.48) ); $graph->SetDataValues($data); $graph->SetLegendPixels(1,5,false); $graph->SetLegend($legend); //Draw it $graph->DrawGraph(); ?>Real Estate Analyzer.php is:
<form name="form2" action="Pie_Chart.php" method="GET" id="user-content-form2"> <input type="hidden" name="Annual_ExpensesH" value="<?php echo $Annual_Expenses; ?>"> <input type="hidden" name="Mortgage_InterestH" value="<?php echo $Mortgage_Interest; ?>"> <input type="submit" name="Calculate" id="Calculate"> </form>Sorry it does have code form name after first $_GET also //Draw it is actually
on top of $graph->DrawGraph(); which is also correct. But I'm not sure about
var_dump($data), is this meant to be included in Pie_Graph.php?
Hi, I have downloaded phplot.php and over-written on the existing file and it
worked!!! But now the problem is that it goes to the does not display on the
Real Estate Analyzer.php page but it displays on Pie_Graph.php. Is there any
way we can display this in the Real Estate Analyzer page?
Because you are using the plot as the action of a form, the plot has to be a
separate page. Here is what you have actually set up:
(Browser) person sees a form. Presses the Submit button.
(Browser) collects the information on the form and sends it to the webserver.
(webserver) sees an incoming form data stream. Creates a Pie_Graph.php
instance and feeds it the form data to graph.
(webserver) onces the graph is finished creating itself, the server sends it
to the person who clicked the submit button.
(Browser) sees a graph.
If that isn't the action you want, then try lbayuk's suggestion to code an IMG
tag with the parameters coded in the URL:
<input type="submit" name="Calculate" id="Calculate">
"; ?>This will put the img tag below your form, and when somebody clicks Submit,
tag from there and not mess around with this form. The way this is set
the page will reload with the graph showing the numbers filled into the form.
Note you have hidden fields for the inputs, so the user can't input numbers.
If you have another page that generates the numbers to plot, you can call the
up, somebody still needs to press a submit button to make it work.
Side note: Added to my TODO list for the reference manual: Add a short but
complete example of a web form handler script and plot generator script.
It is now working perfectly. Thank you very much for your support you saved my
life!!!! One question I had was that is there any customized phplot graphs
that I could download so I can use them in some of my future projects? I'm not
sure if there are any nice looking 3D ones around...