PDA

View Full Version : Pages



hl
June 12th, 2005, 12:49 AM
How do you go about having previous/next buttons in PHP using an array?

For example: array:
1|hello
2|what's up

having 1 to a page. yeah.

Respond with any comments/tutorials if possible.

Yeldarb
June 12th, 2005, 01:51 AM
Use a $_GET variable
like yoursite.php?arrVal=1
echo $array[$_GET['arrVal']];

Or something. And then use $next = $_GET['arrVal']+1; to have a link to the next page (with a $_GET val of $next).

bwh2
June 12th, 2005, 01:58 AM
i'm not clear on why you think an array is necessary. could you give a sample of what you're talking about or better describe how you want these buttons to function?

hl
June 12th, 2005, 02:58 AM
i'm saying dynamic pagination

for example, in a blog... you might want 5 to a page, dynamic. maybe now you'll get it.

outputting the contents of an array, on pages.

Yeldarb
June 12th, 2005, 10:37 AM
Is it coming from a database? If it's just a static array in a page, see my above post.

nobody
June 12th, 2005, 11:33 AM
I think you're talking about pagination. Do a search for that and see if it's what you're talking about

hl
June 13th, 2005, 12:20 AM
@yel:
dynamic think of a flatfile database system.;
@28:
pagination :).

hl
June 13th, 2005, 12:24 AM
nevermind, some brainstorming let me figure it out, thanks anyways.