On Sat, January 27, 2007 8:42 am, koen wrote:
> How to creat the effect of the explorers back and forward buttons in
> php?
Something like this, except I almost for sure have a one-off error or
got the 'push' confused with 'shift' as I always do...
<?php
$session_start();
$history = $_SESSION['history'];
$current_page = array_pos($_SERVER['PHP_SELF'], $history);
if ($current_page === false){
array_push($_SERVER['PHP_SELF'], $history);
$current_page = 0;
$_SESSION['history'] = $history;
}
if (count($history) > $current_page){
$last_page = $history[$current_page - 1];
echo "<a href=\"$last_page\">Back</a>\n";
}
else echo "Back";
if ($current_page !== 0){
$next_page = $history[$current_page + 1];
echo "<a href=\"$next_page\">Next</a>\n";
}
else echo "Next";
?>
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php