Bir bağlantı PHP tıklandığında sayacı artırma

0 Cevap php

Ben şu HTML / PHP kodu vardır:

    <img id="imageViewer"src="someData" height="" width="" alt=""></img>
        <?php
            //a counter so we know what image to return
            $counter =0;

            print("<a href='#'>Click me</a>");

            $imageArray = array(0 => "image link", 1 => "image link", 2=>"image link", 3=>"image link");

            if ($counter<= count($imageArray))
            {
                $pathToImage = imageArray[$counter];
            }
            else
            {
                $counter =0;
                $pathToImage = imageArray[$counter];
            }

            //code to replace old image with new image

        ?>

Link tıklandığında, ve daha sonra diziden seçilir ne dayalı yeni bir resim göstermek için görüntüyü değiştirebilir olduğunda nasıl $counter artırmak mı?

0 Cevap