How to pass array from one page to another in php?
<p>hi i got the  dynamic arry to get on one form i need to pass that array to other forms as well.In that i perfomed some computation as well that i show below i need to pass <code>$data_t1</code> as it contain the dynamic array show can i pass ths to other form.</p>

<p>page1.php</p>

<pre><code>    &lt;?php

        for ($i = 1; $i &lt;= $de; $i++) {
        ?&gt;
        &lt;tr&gt;

            &lt;td&gt;
                &lt;select id="in4-&lt;?php echo $i; ?&gt;" name="t1[&lt;?php echo $i; ?&gt;]" onclick="getText3(&lt;?php echo $i; ?&gt;)" onchange="getText39(&lt;?php echo $i; ?&gt;)" onmouseout="getText89(&lt;?php echo $i; ?&gt;)"&gt;
                    &lt;option value="0"&gt;0&lt;/option&gt;
                    &lt;option value="12"&gt;12&lt;/option&gt;
                    &lt;option value="18"&gt;18&lt;/option&gt;
                    &lt;option value="24"&gt;24&lt;/option&gt;
                    &lt;option value="75"&gt;75&lt;/option&gt;
                &lt;/select&gt;
            &lt;/td&gt;
            &lt;td&gt;
                &lt;input type="text" name="t2[&lt;?php echo $i; ?&gt;]" id="in1-&lt;?php echo $i; ?&gt;" onblur="getText3(&lt;?php echo $i; ?&gt;)" onchange="getText39(&lt;?php echo $i; ?&gt;)" onmouseout="getText89(&lt;?php echo $i; ?&gt;)"/&gt;
            &lt;/td&gt;
            &lt;td&gt;
                &lt;select name="a1[&lt;?php echo $i; ?&gt;]" id="in2-&lt;?php echo $i; ?&gt;" onclick="getText3(&lt;?php echo $i; ?&gt;)"onchange="getText39(&lt;?php echo $i; ?&gt;)" onmouseout="getText89(&lt;?php echo $i; ?&gt;)" &gt;
                    &lt;option value="0"&gt;0&lt;/option&gt;
                    &lt;option value="1"&gt;1&lt;/option&gt;
                    &lt;option value="2"&gt;2&lt;/option&gt;
                    &lt;option value="3"&gt;3&lt;/option&gt;
                    &lt;option value="4"&gt;4&lt;/option&gt;
                    &lt;option value="5"&gt;5&lt;/option&gt;
                    &lt;option value="6"&gt;6&lt;/option&gt;
                    &lt;option value="7"&gt;7&lt;/option&gt;
                    &lt;option value="8"&gt;8&lt;/option&gt;
                &lt;/select&gt;
            &lt;/td&gt;
            &lt;td&gt;
                &lt;input type="text" id="in3-&lt;?php echo $i; ?&gt;" name="username[&lt;?php echo $i; ?&gt;]" readonly="readonly" /&gt;
            &lt;/td&gt;
&lt;?php }?&gt;
        &lt;/table&gt;

    &lt;input type="submit" name="submit" /&gt;



coding of acessing array from page1.php

&lt;?php

if (isset($_POST['submit'])) {

    $data_t1 = $_POST['t1'];


    foreach ($data_t1 as $key =&gt; $value) {

        $value ;
       $_POST['t2'][$key];
    $_POST['a1'][$key];
      $_POST['username'][$key]; 



    }
      $data_t2 = $_POST['t2'];
      $data_t3=$_POST['a1'];
      $data_t4=$_POST['username'];

}

?&gt;
  &lt;?php
  //database connection
$db = new PDO("mysql:host=localhost;dbname=ems",'root','');
//query
$sql = "INSERT INTO table1 (c0,c1, c2, c3, c4 ,c13) VALUES ('',:c1, :c2, :c3, :c4, '$d')";
$stmt = $db-&gt;prepare($sql);
foreach ($data_t1 as $i =&gt; $value) {
    $stmt-&gt;execute(array(
       ':c1'=&gt;$data_t1[$i],
       ':c2'=&gt;$data_t2[$i],
       ':c3'=&gt;$data_t3[$i],
       ':c4'=&gt;$data_t4[$i],
    ));
} ?&gt;
&lt;?php
include('config.php');
$sa="select * from table1 where timestamp=now()";
$result=mysql_query($sa) or die(mysql_error());
$th=-2;
$xa=1;
$xb=2;
$xc=2;
echo "&lt;table border='1'&gt;
&lt;tr&gt;

&lt;/tr&gt;";
$row_count=0;

while($row = mysql_fetch_array($result)) 
{ 
     $row['c1'];
   $row['c2'];
     $row['c3'];
     $row['c4'];

    $a[]=$row['c1'];
        $b[]=$row['c2'];
            $c[]=$row['c3'];
            $d[]=$row['c4'];

            //tube lights//
                $m[]=round(($row['c1']/$row['c4']),2);
                $n[]=round(($row['c2']/$row['c4']),2);
                $o[]=round(($row['c3']/$row['c4']),2);

                //ccr model technique//
                //tube lights//
                $m1[]=abs(round((((($row['c1'])*($th)+($row['c1']*$xa)+($row['c5']*$xb)+($row['c9']*$xc))+1)/2),2));
                $n1[]=abs(round((((($row['c2'])*($th)+($row['c2']*$xa)+($row['c6']*$xb)+($row['c10']*$xc))+1)/2),2));
                $o1[]=abs(round((((($row['c3'])*($th)+($row['c3']*$xa)+($row['c7']*$xb)+($row['c11']*$xc))+1)/2),2));



                $row_count++;

}

 //optimial values//
$fa=implode($a,',');
$fa1=explode(',',$fa);
$fb=implode($b,',');
$fb1=explode(',',$fb);
$fcc=implode($c,',');
$fcc1=explode(',',$fcc);
$fe=implode($e,',');
$fe1=explode(',',$fe);
$ff=implode($f,',');


    //for efficeiency frointer//

for($i=0;$i&lt;$row_count;$i++) 
{ // do the exploding, the imploding, the row echoing for each row// 
echo "&lt;table border='1' align='center'&gt;
&lt;tr&gt;
&lt;th&gt;Inputs&lt;/th&gt;
&lt;th&gt;A&lt;/th&gt;
&lt;th&gt;B&lt;/th&gt;
&lt;th&gt;C&lt;/th&gt;
&lt;/tr&gt;";
echo "Measuring1".($i+1);
  echo "&lt;tr&gt;";
  //tube lights//
     $f=implode($m,',');
     $r=explode(',',$f);

     $f1=implode($n,',');
     $r1=explode(',',$f1);

     $f2=implode($o,',');
     $r2=explode(',',$f2);


echo "&lt;td&gt;" ."W"&lt;/td&gt;";
echo "&lt;td&gt;".$r[$i]. "&lt;/td&gt;";
echo "&lt;/tr&gt;"; 
echo  "&lt;td&gt;" ."No. "&lt;/td&gt;";
echo "&lt;td&gt;".$r1[$i]. "&lt;/td&gt;";
;
 echo "&lt;/tr&gt;"; 
echo  "&lt;td&gt;" ."Dur "."&lt;/td&gt;";
echo "&lt;td&gt;".$r2[$i]. "&lt;/td&gt;";
echo "&lt;/tr&gt;"; 

echo  "&lt;/table&gt;";
}
for($i=0;$i&lt;$row_count;$i++) 
{
echo "&lt;table border='1' align='center'&gt;
&lt;tr&gt;
&lt;th&gt;Inputs&lt;/th&gt;
&lt;th&gt;ccr&lt;/th&gt;
&lt;th&gt;ccr&lt;/th&gt;
&lt;th&gt;Ccr&lt;/th&gt;
&lt;/tr&gt;";
  echo "&lt;tr&gt;";
  echo "Measuring 2".($i+1);  
      //tube lights//
     $fc=implode($m1,',');
     $rc=explode(',',$fc);

     $fc1=implode($n1,',');
     $rc1=explode(',',$fc1);

     $fc2=implode($o1,',');
     $rc2=explode(',',$fc2);

     //ccr model technique// 
 echo "&lt;td&gt;" ."Wa ". "&lt;/td&gt;";
echo "&lt;td&gt;".$rc[$i]. "&lt;/td&gt;";
echo "&lt;/tr&gt;"; 
echo  "&lt;td&gt;" ."n ". "&lt;/td&gt;";
echo "&lt;td&gt;".$rc1[$i]. "&lt;/td&gt;";
echo "&lt;/tr&gt;"; 
echo  "&lt;td&gt;" ."Dur "."&lt;/td&gt;";
echo "&lt;td&gt;".$rc2[$i]. "&lt;/td&gt;";
echo  "&lt;/table&gt;";
}
?&gt;

&lt;?php
for($i=0;$i&lt;$row_count;$i++) 
{
echo "&lt;table border='1' align='center'&gt;
&lt;tr&gt;
&lt;th&gt;Inputs&lt;/th&gt;
&lt;th&gt;A&lt;/th&gt;
&lt;th&gt;B&lt;/th&gt;
&lt;th&gt;C&lt;/th&gt;
&lt;/tr&gt;";
 echo "&lt;tr&gt;";
  echo " Optimial values Of Room ".($i+1);
  //voltage of appliances//
   echo "&lt;td&gt;" ."W". "&lt;/td&gt;";
if($fa1&lt;=$rc)
{

echo "&lt;td&gt;". $fa1[$i]."&lt;/td&gt;";
}
else
{

echo "&lt;td&gt;". $rc[$i]."&lt;/td&gt;";
}
  echo "&lt;tr&gt;";
      echo "&lt;td&gt;" ."Du". "&lt;/td&gt;";
if($fcc1&lt;=$rc2)
{
echo "&lt;td&gt;". $fcc1[$i]. "&lt;/td&gt;";
}
else
{
echo "&lt;td&gt;". $rc2[$i]. "&lt;/td&gt;";
}
echo "&lt;/tr&gt;";
 echo "&lt;tr&gt;";
    echo "&lt;td&gt;" ."Co". "&lt;/td&gt;";
if($fa1&lt;=$rc &amp;&amp; $fb1&lt;=$rc1 &amp;&amp; $fcc1&lt;=$rc2 )
{

 $gk[]=round(((($fa1[$i]*$fb1[$i]*$fcc1[$i])*30)/1000),2);
 echo  "&lt;td&gt;" . $gk[$i]. "&lt;/td&gt;";
 }
else
{
$gk1[]=round(((($rc[$i]*$rc1[$i]*$rc2[$i])*30)/1000),2);
 echo  "&lt;td&gt;" . $gk1[$i]. "&lt;/td&gt;";
}

?&gt;
</code></pre>

<p>plz help me for ths.</p>
