how to get array value in another page
<p>page1.php</p>

<pre><code>$destinationCity = $_POST['destination'];
$sr = new searchArray();
$final = $sr-&gt;searcharray($destinationCity);
echo "&lt;pre&gt;";
print_r($final);
echo $final-&gt;vc[0];
echo "&lt;/pre&gt;";
</code></pre>

<p>Page2.php</p>

<pre><code>class searchArray {

public function searcharray($arr) {
   $rst = array();
   $length = strlen($arr);
    if ($length == 2){
        $sql = "select code from ukhotels where postcode LIKE '$arr%'";
        $rsd = mysql_query($sql);
        while($rs = mysql_fetch_array($rsd)){
        $co = $rs['code'];
        $vc = &amp;$rst['vc'];
        $vi = &amp;$rst['vi'];

        $vc[] = substr($co, 0, 2);
        $vi[] = substr($co, 3, strlen($co));

    }

    }
</code></pre>

<p>In page1 i am calling the function with one argument. In the page2 i am keeping the results in an associate array.</p>

<p>When I am printing the array from page1 its showing me output as</p>

<pre><code>Array
(
[vc] =&gt; Array
    (
        [0] =&gt; CB
        [1] =&gt; RD
        [2] =&gt; RT
        [3] =&gt; YX
    )

[vi] =&gt; Array
    (
        [0] =&gt; 01461 
        [1] =&gt; 95101 
        [2] =&gt; 30818 
        [3] =&gt; 77126 
    )

)
</code></pre>

<p>i wanted to use the array in page1 like this </p>

<pre><code>for($i=0, $j=1;$i&lt;=20;$i++)
{
$params["VendorLocation"]["VendorCode"] = "{$final-&gt;vc[$i]}";
$params["VendorLocation"]["VendorLocationID"] = "{$final-&gt;vi[$i]}";
$params["VendorLocation"]["Key"] = "{$j}";
$j++;
}    
</code></pre>

<p>but it is throwing me an error saying " Notice: Trying to get property of non-object "</p>

<p>Can any one please help me how to solve this issues.</p>

<p>Regards
Hailey</p>
