Jump to content

[SOLVED] array and links


zang8027

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/153865-solved-array-and-links/
Share on other sites

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;}

}

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.