Page 1 of 1

Passing arrays trough pages!

Posted: Mon Feb 07, 2005 5:47 am
by pedrokas
Hi again
i tried to pass an array trought pages, and the only solutions i get (not mutch time to think) was passing the values as parameters.
I think, and hope, there are a better and cleaner way to do it, and my question to you all is ...HOW?

$myrec[number] = field from a table;
$arrystr = my array, in this case only 4 rows;
$nor_arrystr = number of rows of the array; // 4

Code: Select all

<? 
(...)
echo ($novotit."<a href = "nextpage.php?$numnot=$myrec&#1111;number]"); forech($arrystr as $k =>$n)
&#123;
  echo("&val$k=$n");
&#125;
echo("&tot=".$nor_arrystr."">ver</a>");
(...)
?>
in the nextpage.php ...

Code: Select all

<?
$array_loc = array();
$nor_array = $_GET&#1111;'tot'];
for($i = 0; $ <= $nor_array; $i++)
&#123;
  array_push($array_loc, $_GET&#1111;'val'.$i]);
&#125;
?>

Posted: Mon Feb 07, 2005 6:00 am
by timvw
http://www.php.net/session

this way you don't have to copy the data back-and-forth between server and client either....