Limit array results and increment through when button is clicked
<p>What I am hoping to do is display the first 5 items (Stage1 - Stage5) from the array when the page is loaded. To the side I will have two images one arrow pointing up and one arrow down. If the down arrow is clicked the array is incremented to display (Stage2 - Stage6). Another click on the down arrow the screen would display (Stage3 - Stage7). Then the up arrow does the same but the opposite direction.</p>

<p>With the code I have below I can manually add "1" to $var1 and $var2 or subtract 1 when needed, save and refresh the browser to get the effect I am looking for. I just can't seem to figure out how to do the increments of $var1 and $var2 and then refresh the page, all automatically when the arrow images are clicked.</p>

<p>I am new so I could be completely off with what I have but hopefully it at least helps show what I want to do.</p>

<pre><code>&lt;?php

$stage_name=array
("Stage1","Stage2","Stage3","Stage4",
"Stage5","Stage6","Stage7","Stage8",
"Stage9","Stage10","Stage11","Stage12",
"Stage13","Stage14","Stage15","Stage16");

?&gt;
&lt;html&gt;
&lt;body&gt;
&lt;?php
$var1=0; $var2=5;
for($list=$var1; $list&lt;$var2; $list++)
{
    foreach($stage_name as $stage_index =&gt; $stage_item)
    {
        if ($stage_index==$list)
            print("$stage_item&lt;br /&gt;");
    }
}
?&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>Thanks</p>
