index.php
Código PHP:
<!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=iso-8859-1" />
<title>Documento sin título</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="grafica.php">
<label>
VALOR 1:
<input name="valor1" type="text" id="valor1" />
</label>
<p>
<label>VALOR 2:
<input name="valor2" type="text" id="valor2" />
</label>
</p>
<p>VALOR 3:
<label>
<input name="valor3" type="text" id="valor3" />
</label>
</p>
<p>
<label>
<input type="submit" name="Submit" value="Enviar" />
</label>
</p>
</form>
</body>
</html>
Código PHP:
<?php
$valor1=$_POST['valor1'];
$valor2=$_POST['valor2'];
$valor3=$_POST['valor3'];
require_once ("jpgraph/jpgraph.php");
require_once ("jpgraph/jpgraph_line.php");
require_once ("jpgraph/jpgraph_bar.php");
// content="text/plain; charset=utf-8"
//$datay = array($valor1,$valor2,$valor3);
$datay = array(12,56,34);
$targ = array($valor1,$valor2,$valor3);
$alt = array($valor1,$valor2,$valor3);
// Create the graph.
$graph = new Graph(980,680);
$graph->SetMarginColor('white');
$graph->SetScale("textlin");
$graph->SetShadow();
$graph->SetFrame(true);
$graph->img->SetMargin(80,30,80,40);
$graph->title->Set('GRAFICA');
$graph->ygrid->SetFill(true,'#[email protected]','#[email protected]');
// Create the linear plot
$lineplot=new LinePlot($datay);
$lineplot->SetCenter();
$lineplot->mark->SetType(MARK_FILLEDCIRCLE);
$lineplot->mark->SetWidth(5);
$lineplot->mark->SetColor('black');
$lineplot->mark->SetFillColor('red');
$lineplot->SetCSIMTargets($targ,$alt);
// Add the plots to the graph
$graph->Add($lineplot);
$graph->StrokeCSIM();
?>
Código php:
Ver original
pero si lo cambio por esto
Código php:
Ver original
aparece error de q el array no contiene nada, alguien q me pueda ayudar, e estoy volviendo loco con esto