Incrementing variable in php after action is processed?
<p><strong>Aim of my Program:</strong> </p>

<ol>
<li>On my index.php file, an image is displayed. </li>
<li>I want that, when i user clicks that image, a new image should be displayed.</li>
<li>And when he clicks the new image, another new image should appear.</li>
</ol>

<p><strong>What have i done till now ?</strong></p>

<pre><code>&lt;?php
$mycolor = array("red.jpg", "green.jpg", "blue.jpg");
$i = 0;
$cc = $mycolor[$i++];
?&gt;


&lt;form method="post" action="index2.php"&gt;
&lt;input type="image" src="&lt;?php echo $cc; ?&gt;"&gt;
&lt;/form&gt;
</code></pre>

<p>I know what the error is. Whenever, the page is reloaded, the variable $i is initialized to ZERO. How, do i fix that. How can I retain the incremented value after the image is clicked ?</p>

<p>Also, I have no Javascript Knowledge. So, if possible explain me in terms of php.</p>
