Ver Mensaje Individual
  #10 (permalink)  
Antiguo 24/08/2011, 13:14
Avatar de andresdzphp
andresdzphp
Colaborador
 
Fecha de Ingreso: julio-2011
Ubicación: $this->Colombia;
Mensajes: 2.749
Antigüedad: 12 años, 9 meses
Puntos: 793
Respuesta: Como pasar los valores de un campo de texto a un array

Te recomiendo que leas un manual de PHP, así se hace en el caso de que séa un sólo número:

Código PHP:
Ver original
  1. <?php
  2. include("inc/jpgraph.php");
  3. include("inc/jpgraph_line.php");
  4.  
  5. $xyz = array();
  6. $xyz[] = $_POST['uno'];
  7.  
  8. $graph = new Graph(350, 250,  "auto");    
  9. $graph->SetScale( "textlin");
  10. $graph->img->SetMargin(40, 20, 20, 40);
  11. $graph->title->Set("Tres Lineas");
  12. $graph->xaxis->title->Set("gracias");
  13. $graph->yaxis->title->Set("por todo");
  14.  
  15. $lineplot1 = new LinePlot($xyz);
  16. $lineplot1->SetColor("blue");
  17.  
  18. $graph->Add($lineplot1);
  19. $graph->Stroke();
  20. ?>

y así en el caso de que en el campo con nombre uno, separes varios números con comas. Cual bucle ni que cuentos...

Código PHP:
Ver original
  1. <?php
  2. include("inc/jpgraph.php");
  3. include("inc/jpgraph_line.php");
  4.  
  5. $xyz = array();
  6. $xyz = explode(',',$_POST['uno']);
  7.  
  8. $graph = new Graph(350, 250,  "auto");    
  9. $graph->SetScale( "textlin");
  10. $graph->img->SetMargin(40, 20, 20, 40);
  11. $graph->title->Set("Tres Lineas");
  12. $graph->xaxis->title->Set("gracias");
  13. $graph->yaxis->title->Set("por todo");
  14.  
  15. $lineplot1 = new LinePlot($xyz);
  16. $lineplot1->SetColor("blue");
  17.  
  18. $graph->Add($lineplot1);
  19. $graph->Stroke();
  20. ?>
__________________
Si sabemos como leer e interpretar el manual será mucho más fácil aprender PHP. En lugar de confiar en ejemplos o copiar y pegar - PHP