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!!
<?php
$i = 0;
if($i > 6){
$i = 0;
}
if($i < 0){
$i = 6;
}
//Next Function
function next_funct($i) {
if($_POST['next']) {
++$i;
echo "<meta http-equiv=\\"refresh\\" content=\\"0\\">";
}}
//Prev Function
function prev_funct ($i) {
if($_POST['prev']) {
--$i;
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" />
</a>
<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">
</FORM></div>