Php Refresh button-fallback

I’m new to php and attempting to set up a simple php gallery, where the next and prev buttons count up and down through an array then issue a page refresh when pushed.

I know I can do this with js, but I’m wanting just a regular php fallback if js isn’t loaded. For some reason, I cannot get this to work! I can display the array images, links, etc, I just can’t find a good reference to get the regular ole form buttons to call a refresh within a function. Any ideas how I can fix this? Thanks in advance!!

$i = 0;
if($i > 6){
        $i = 0;
if($i < 0){
        $i = 6;
//Next Function
function next_funct($i) {
        if($_POST['next']) {
        echo "<meta http-equiv=\\"refresh\\" content=\\"0\\">";

//Prev Function
function prev_funct ($i) {
        if($_POST['prev']) {
        echo "<meta http-equiv=\\"refresh\\" content=\\"0\\">";

$current_page = $_SERVER['PHP_SELF'];


<div id="slideshow">
<a href="<?php echo $artlinks[$i]?>">
<img src="<?php echo $art[$i] ?>" alt="Art Slideshow Image" />
<FORM method="post" action="<?php $current_page ?>">
<INPUT TYPE="button" onclick="<?php echo prev_funct?>" name="prev" class="l_btn">
<INPUT TYPE="button" onclick="<?php echo next_funct?>" name="next" class="r_btn">

Welcome to SitePoint smathis!

So, I’m guessing you have 6 pages, all stored in array? Can you post that array please?

Well, including the 0 value there will be 7 total. Arrays seem to be working fine. Most of these are dummy values just for testing purposes.

$art = array("../gallery/thumbs/thumb_kuei_shen.jpg","../gallery/thumbs/thumb_bakunawa.jpg", "../gallery/thumbs/thumb_geneti_v1.jpg", "../gallery/thumbs/thumb_kuei_shen.jpg","../gallery/thumbs/thumb_bakunawa.jpg", "../gallery/thumbs/thumb_geneti_v1.jpg", "../gallery/thumbs/thumb_geneti_v2.jpg");

$artlinks = array("../contents/eldritchgods.html", "../contents/eldritchgods.html", "../contents/geneti.html", "../contents/eldritchgods.html", "../contents/eldritchgods.html", "../contents/geneti.html", "../contents/geneti.html");