Im trying to rotate adverts with each new page or refresh, so when visitor gets to index page AD01.jpg is displayed, when they go to next page or refresh AD02.jpg is displayed, when all ads have been displayed it then reverts to AD01.jpg. Please be gentle, Im new to this stuff and I distroyed my memory in the 80s
how are you controlling the ads? if they’re in a db table, then you could use a random number picker to pick a new id and load it when the page refreshes. Its not perfect but that’s how i used to do it.
You could also set a variable to 1 or 0 using a hidden form input. if its 1, switch to another ad, then change it 1 back to 0, then just keep switching it between 1 and 0 to rotate ads.
Another way that I used in the past is to use a SESSION variable. At the very beginning of the page, add one to the SESSION variable and pull that AD to display. When you reach the last one set it back to zero.
What’s nice with this way is if the user manually refreshes, it will automatically go to the next page…
Lots of ways to do this. Depends a little on where you are pulling the ad’s from. Good luck…