zang8027 Posted April 13, 2009 Share Posted April 13, 2009 I have an array that i will fill with some different values.. these values will refer to an include. I want to have a previous - next link that when you click on one, it refers to a new value.. next or previous value. What this is designed to do is include different files which are stored in a array. So my array looks like: <?php $myArray = array('article1.php','article2.php'); ?> so how can I add a link to schedule.php? Im not sure what to put as a param. Im looking for something like schedule.php?art=1... if you hit next, it sets art=2. But i also dont want to be able to go to..say art5 if it does not exist in the array Quote Link to comment Share on other sites More sharing options...
ober Posted April 13, 2009 Share Posted April 13, 2009 You'll want to look at the count function to determine how many elements are in the array which will then allow you to determine which links to show. You'll also need to read $_GET['art'] to determine the page you are on. Quote Link to comment Share on other sites More sharing options...
zang8027 Posted April 13, 2009 Author Share Posted April 13, 2009 thanks, i solved it $myArray = array('voiceMaster.php','voiceMaster.php','voiceMaster.php','voiceMaster.php'); $count = count($myArray); if(isset($_GET['artID'])) { $currentID = $_GET['artID']; if($_GET['artID'] > 0) { $artIDP = $currentID - 1; $currentID = $_GET['artID']; }else{$artIDP = $currentID;} if($_GET['artID'] < $count) { $artIDN = $currentID + 1; $currentID = $_GET['artID']; }else{$artIDN = $currentID;} } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.