problem calculating the position using php
<p>I have a function below which gets name from a site. Below is the partial code, not complete. The values are passed thru a for loop using php.</p>

<pre><code>function funct($$name,$page)

    {
        $url="http://testserver.com/client?list=$name&amp;page=$page";

        $ch=curl_init();

        curl_setopt($ch,CURLOPT_URL,url);
        $result=curl_exec($ch);

            $dom = new DOMDocument();
            @$dom-&gt;loadHTML($result);

            $xpath=new DOMXPath($dom);
            $elements = $xpath-&gt;evaluate("//div");
            foreach ($elements as $element)
            {
                $name  = $element-&gt;getElementsByTagName("name")-&gt;item(0)-&gt;nodeValue;
                $position=$position +1;

                echo $name.$position;
            }   
        }
</code></pre>

<p>The code works fine but when i get a name i need to add a position and for each name it will be incremented by 1 to make it contentious. But when the values for the pages are passed, for an example when i move from page 1 to page 2. the count starts again from first, next page... same problem.</p>

<p>How can i make it continues on every page?</p>
